ProfessionalWiki / chameleon

Provides a highly flexible and customizable skin using Bootstrap 4
https://www.mediawiki.org/wiki/Skin:Chameleon
Other
116 stars 62 forks source link

Add PHP 8.1 compat #311

Closed JeroenDeDauw closed 2 years ago

JeroenDeDauw commented 2 years ago

Fixes https://github.com/ProfessionalWiki/chameleon/issues/309

malberts commented 2 years ago

Trying to run unit tests with PHP 8.1 leads to this:

1) Skins\Chameleon\Tests\Unit\Components\ComponentTest::testCanConstruct_withClassAttribute
Error: Call to undefined method ReflectionUnionType::getName()

/var/www/html/skins/chameleon/tests/phpunit/Unit/Components/ComponentTest.php:74

2) Skins\Chameleon\Tests\Unit\Components\ComponentTest::testGetDomElement
Error: Call to undefined method ReflectionUnionType::getName()

/var/www/html/skins/chameleon/tests/phpunit/Unit/Components/ComponentTest.php:169

3) Skins\Chameleon\Tests\Unit\Components\NavbarHorizontalTest::testGetHtml_containsNavElement
Error: Call to undefined method ReflectionUnionType::getName()

Which apparently is due to PHPUnit 8.5 having some compatibility issues with new PHP 8.1 stuff: e.g. https://github.com/sebastianbergmann/phpunit/issues/4879

https://phpunit.de/supported-versions.html

PHPUnit 8.5 works for PHP code compatible with PHP 7.2 on PHP 8. However, PHPUnit 8.5's test double code generator does not support PHP 8's union types syntax, for example.

To get past that for now I'm skipping those tests for PHP 8.1.