-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Incompatibility with PhpUnit 9.5.10 #3490
Comments
This is related to the fact that you are clearly using the PHPCS native test framework to run the sniff tests for an external standard. It is, of course, perfectly fine to do so and quite common practice, but if you do, you need to abide by the PHPUnit version constraints as set by PHPCS, which are currently As for getting things working:
Also related to #3395 |
@jrfnl Thanks for your comment! |
@Koen1999 What do you mean with |
That's a typo, I meant to say PhpCS. This project, the code sniffer. |
Ah, I understand, but the thing is: you can. See my pointers above on how. |
Your pointers suggest using PHPUnit 7, but this does not work with certain features of PHP 8.1 when running tests. (sadly, I did not store the example for reference). https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md According to the changelog, you require PhpUnit ^9.5.8 when using PHP 8.1. |
@Koen1999 Running tests based off the PHPCS test framework will work fine on PHP 8.1 with PHPUnit 7.5 as described above. Seriously, PHPCS itself does so and I'm doing it for a number of external standards too. The only thing which probably won't work well is running code-coverage. In most cases, you'd only run code coverage for a select number of builds anyway, not all builds, so just don't use your PHP 8.1 builds for your code coverage runs. |
Describe the bug
PHP Fatal error: Declaration of PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest::setUp() must be compatible with PHPUnit\Framework\TestCase::setUp(): void in /home/user/laminas-ldap/vendor/squizlabs/php_codesniffer/tests/Standards/AbstractSniffUnitTest.php on line 55
Custom ruleset
https://github.com/laminas/laminas-coding-standard/blob/2.3.0/src/LaminasCodingStandard/ruleset.xml
To reproduce
Steps to reproduce the behavior:
php7.4 vendor/bin/phpcs --standard=LaminasCodingStandard --colors -p --extensions=php .
PHPCS output here
PHP Fatal error: Declaration of PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest::setUp() must be compatible with PHPUnit\Framework\TestCase::setUp(): void in /home/user/laminas-ldap/vendor/squizlabs/php_codesniffer/tests/Standards/AbstractSniffUnitTest.php on line 55
Versions (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: