Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8 support #23

Open
enumag opened this issue Feb 22, 2021 · 2 comments · May be fixed by #24
Open

PHP 8 support #23

enumag opened this issue Feb 22, 2021 · 2 comments · May be fixed by #24

Comments

@enumag
Copy link
Contributor

enumag commented Feb 22, 2021

Currently this bundle doesn't allow PHP 8. All required packages seem to already do so. Is there any blocker here?

@rzeczkowskip
Copy link

As I see, the phpunit is blocking right now. I've tried the upgrade to version 9.5.2 and found another bug (9 to be exact):

1) JK\MoneyBundle\Tests\Twig\MoneyExtensionTest::testMoneyFilter with data set #0 ('cs_CZ', 'CZK', 2, true, true, 1599, '15,99 Kč')
TypeError: NumberFormatter::setAttribute(): Argument #2 ($value) must be of type int|float, bool given

/app/Twig/MoneyExtension.php:43
/app/Tests/Twig/MoneyExtensionTest.php:54

Fix is rather easy in Twig/MoneyExtension.php:43

-        $noFormatter->setAttribute(NumberFormatter::GROUPING_USED, $groupingUsed);
+        $noFormatter->setAttribute(NumberFormatter::GROUPING_USED, $groupingUsed ? 1 : 0);

Another way would be changing values of consts to integers:

    const GROUPING_USED = true;
    const GROUPING_NONE = false;

The first option isn't a BC break.

I can prepare a PR if you want.

@enumag
Copy link
Contributor Author

enumag commented Feb 22, 2021

Personally I'd use this but ofc I'm not the maintainer here... use whichever non-BC break method you like, I'm sure the PR will be appreciated.

$noFormatter->setAttribute(NumberFormatter::GROUPING_USED, (int) $groupingUsed);

@enumag enumag linked a pull request Feb 25, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants