Problem/Motivation
The 1.15.0 version of select2 includes Union types in Select2Test.php, which is a PHP 8 feature. However the composer.json in the module doesn't specify the required version. This can lead to module requiring/updates via composer passing platform requirements when they shouldn't.
Steps to reproduce
Run a phpunit test while on PHP 7.4.x, this error will still occur when no test is run as it seems to trip in PHPUnit\Util\FileLoader::load
./vendor/bin/phpunit --configuration=web/core/ --group=foo --testsuite=unit
PHP Fatal error: Uncaught ParseError: syntax error, unexpected '|', expecting variable (T_VARIABLE) in /var/www/site/web/modules/contrib/select2/tests/src/Unit/Element/Select2Test.php:199
Stack trace:
#0 /var/www/site/vendor/phpunit/phpunit/src/Util/FileLoader.php(49): PHPUnit\Util\FileLoader::loadProposed resolution
Add a platform dependency for PHP 8 in the projects composer.json
"require": {
"php": ">=8.1",
...
},
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | select2-3424485.patch | 350 bytes | abhishek_gupta1 |
Issue fork select2-3424485
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
abhishek_gupta1 commented@jnlar , above MR seems to be failed.I have added changes to patch file. please kindly review it.
Comment #5
jnlarthanks @abhishek_gupta1, those changes look OK. As for the CI failing it looks like some unit tests are failing, none of which are an affect of this change. So I'd say there outside the context of this issue.
Comment #6
chr.fritsch