php-gettext / Gettext

PHP library to collect and manipulate gettext (.po, .mo, .php, .json, etc)
MIT License
687 stars 134 forks source link

Fix for PHP 7.4 #230

Closed remicollet closed 4 years ago

remicollet commented 4 years ago

With this patch:

$ vendor/phpunit/phpunit/phpunit 
PHPUnit 5.7.23 by Sebastian Bergmann and contributors.

..........E...................................................... 65 / 99 ( 65%)
..................................                                99 / 99 (100%)

Time: 95 ms, Memory: 8,00MB

There was 1 error:

1) Gettext\Tests\AssetsTest::testTwig
Twig_Error_Syntax: An exception has been thrown during the compilation of a template ("Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`").

/work/GIT/Gettext/vendor/twig/twig/lib/Twig/Environment.php:566
/work/GIT/Gettext/src/Extractors/Twig.php:30
/work/GIT/Gettext/src/Extractors/Extractor.php:18
/work/GIT/Gettext/src/Translations.php:174
/work/GIT/Gettext/src/Translations.php:153
/work/GIT/Gettext/tests/AbstractTest.php:49
/work/GIT/Gettext/tests/AssetsTest.php:384

Caused by
PHPUnit_Framework_Error_Deprecated: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`

/work/GIT/Gettext/vendor/twig/twig/lib/Twig/Node.php:42
/work/GIT/Gettext/vendor/twig/twig/lib/Twig/Parser.php:349
/work/GIT/Gettext/vendor/twig/twig/lib/Twig/TokenParserInterface.php:42
/work/GIT/Gettext/vendor/twig/twig/lib/Twig/TokenParser.php:17
/work/GIT/Gettext/vendor/twig/twig/lib/Twig/TokenParser/For.php:24
/work/GIT/Gettext/vendor/twig/twig/lib/Twig/Extension/Core.php:116
/work/GIT/Gettext/vendor/twig/twig/lib/Twig/ExtensionSet.php:454
/work/GIT/Gettext/vendor/twig/twig/lib/Twig/ExtensionSet.php:429
/work/GIT/Gettext/vendor/twig/twig/lib/Twig/ExtensionSet.php:398
/work/GIT/Gettext/vendor/twig/twig/lib/Twig/Environment.php:936
/work/GIT/Gettext/vendor/twig/twig/lib/Twig/Lexer.php:353
/work/GIT/Gettext/vendor/twig/twig/lib/Twig/Lexer.php:65
/work/GIT/Gettext/vendor/twig/twig/lib/Twig/Environment.php:505
/work/GIT/Gettext/vendor/twig/twig/lib/Twig/Environment.php:561
/work/GIT/Gettext/src/Extractors/Twig.php:30
/work/GIT/Gettext/src/Extractors/Extractor.php:18
/work/GIT/Gettext/src/Translations.php:174
/work/GIT/Gettext/src/Translations.php:153
/work/GIT/Gettext/tests/AbstractTest.php:49
/work/GIT/Gettext/tests/AssetsTest.php:384

ERRORS!
Tests: 99, Assertions: 1142, Errors: 1.

The 2 failures are not related to this project, but to twig

remicollet commented 4 years ago

Without this patch

$ php74 /usr/bin/phpunit --bootstrap tests/bootstrap.php --filter '^((?!(testBlade|testTwig)).)*$' tests
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.

EEEEEEEEEEE..E.....................................EE............ 65 / 97 ( 67%)
................................                                  97 / 97 (100%)

Time: 62 ms, Memory: 6.00MB

There were 14 errors:

1) Gettext\Tests\AssetsTest::testPo
TypeError: Argument 1 passed to Gettext\Translations::Gettext\{closure}() must be an instance of Gettext\Translation, array given

/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:438
/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:442
/dev/shm/BUILD/Gettext-4.7.0/tests/AssetsTest.php:20

2) Gettext\Tests\AssetsTest::testPo2
TypeError: Argument 1 passed to Gettext\Translations::Gettext\{closure}() must be an instance of Gettext\Translation, array given

/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:438
/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:442
/dev/shm/BUILD/Gettext-4.7.0/tests/AssetsTest.php:62

3) Gettext\Tests\AssetsTest::testPo3
TypeError: Argument 1 passed to Gettext\Translations::Gettext\{closure}() must be an instance of Gettext\Translation, array given

/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:438
/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:442
/dev/shm/BUILD/Gettext-4.7.0/tests/AssetsTest.php:98

4) Gettext\Tests\AssetsTest::testJed
TypeError: Argument 1 passed to Gettext\Translations::Gettext\{closure}() must be an instance of Gettext\Translation, array given

/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:438
/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:442
/dev/shm/BUILD/Gettext-4.7.0/tests/AssetsTest.php:170

5) Gettext\Tests\AssetsTest::testJsCode
TypeError: Argument 1 passed to Gettext\Translations::Gettext\{closure}() must be an instance of Gettext\Translation, array given

/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:438
/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:442
/dev/shm/BUILD/Gettext-4.7.0/tests/AssetsTest.php:206

6) Gettext\Tests\AssetsTest::testJs2Code
TypeError: Argument 1 passed to Gettext\Translations::Gettext\{closure}() must be an instance of Gettext\Translation, array given

/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:438
/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:442
/dev/shm/BUILD/Gettext-4.7.0/tests/AssetsTest.php:242

7) Gettext\Tests\AssetsTest::testPhpCode
TypeError: Argument 1 passed to Gettext\Translations::Gettext\{closure}() must be an instance of Gettext\Translation, array given

/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:438
/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:442
/dev/shm/BUILD/Gettext-4.7.0/tests/AssetsTest.php:277

8) Gettext\Tests\AssetsTest::testPhpCode2
TypeError: Argument 1 passed to Gettext\Translations::Gettext\{closure}() must be an instance of Gettext\Translation, array given

/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:438
/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:442
/dev/shm/BUILD/Gettext-4.7.0/tests/AssetsTest.php:317

9) Gettext\Tests\AssetsTest::testPhpCode3
TypeError: Argument 1 passed to Gettext\Translations::Gettext\{closure}() must be an instance of Gettext\Translation, array given

/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:438
/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:442
/dev/shm/BUILD/Gettext-4.7.0/tests/AssetsTest.php:355

10) Gettext\Tests\AssetsTest::testVueJs
TypeError: Argument 1 passed to Gettext\Translations::Gettext\{closure}() must be an instance of Gettext\Translation, array given

/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:438
/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:442
/dev/shm/BUILD/Gettext-4.7.0/tests/AssetsTest.php:432

11) Gettext\Tests\AssetsTest::testPhpCode4
TypeError: Argument 1 passed to Gettext\Translations::Gettext\{closure}() must be an instance of Gettext\Translation, array given

/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:438
/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:442
/dev/shm/BUILD/Gettext-4.7.0/tests/AssetsTest.php:478

12) Gettext\Tests\AssetsTest::testXliffUnitIds
TypeError: Argument 1 passed to Gettext\Translations::Gettext\{closure}() must be an instance of Gettext\Translation, array given

/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:438
/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Translations.php:442
/dev/shm/BUILD/Gettext-4.7.0/tests/AssetsTest.php:560

13) Gettext\Tests\StringsTest::testStringFromPhp with data set #13 ('"a\x20b $c"', 'a b $c')
Invalid characters passed for attempted conversion, these have been ignored

/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Extractors/PhpCode.php:125
/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Extractors/PhpCode.php:103
/dev/shm/BUILD/Gettext-4.7.0/tests/StringsTest.php:37

14) Gettext\Tests\StringsTest::testStringFromPhp with data set #14 ('"a\x01b\2 \1 \01 \001 \r \n \t \v \f"', Binary String: 0x6101620220012...00b200c)
Invalid characters passed for attempted conversion, these have been ignored

/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Extractors/PhpCode.php:125
/dev/shm/BUILDROOT/php-gettext-gettext-4.7.0-2.fc29.remi.x86_64/usr/share/php/Gettext/Extractors/PhpCode.php:103
/dev/shm/BUILD/Gettext-4.7.0/tests/StringsTest.php:37

ERRORS!
Tests: 97, Assertions: 457, Errors: 14.
erreur : Mauvais statut de sortie pour /var/tmp/rpm-tmp.11eYYO (%check)