-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fatal error when trying to run a code coverage report #1031
Comments
It looks like you end up mixing version 4.x and 5.x of PHP-Parser somehow. You have 4.x in your project and phpunit comes with it's own version -- how did you install phpunit? If it's a composer dependency things should be correctly resolved. If it's a phar, I'd expect it to be prefixed, but I'm not sure. |
I'm getting the same error. Like OP, I'm running with the symfony phpunit-bridge which will do it's own composer install before running phpunit. I'll dig around on my system and see what's happening. |
@mrunkel When using the PHPUnit bridge you can try using the |
Yes! Thank you for the quick response. My final command for gitlab is:
`XDEBUG_MODE=coverage SYMFONY_PHPUNIT_REQUIRE="nikic/php-parser:^4.13"
bin/phpunit --coverage-cobertura=coverage.xml`
…On Tue, Oct 29, 2024 at 2:43 PM Christian Flothmann < ***@***.***> wrote:
@mrunkel <https://github.com/mrunkel> When using the PHPUnit bridge you
can try using the SYMFONY_PHPUNIT_REQUIRE (to enforce a particular
version of a packe) or SYMFONY_PHPUNIT_REMOVE (to try removing a package)
environment variables.
—
Reply to this email directly, view it on GitHub
<#1031 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAYOQ4AHMJJU5O6SI6HVXFLZ56GI5AVCNFSM6AAAAABPDHLLT6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBUGI3TGNRZG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I'm running:
root@b00c3eb5d255:/app# XDEBUG_MODE=coverage php bin/phpunit --coverage-html .
The error is:
Testing
PHP Fatal error: Declaration of PhpParser\ParserAbstract::parse(string $code, ?PhpParser\ErrorHandler $errorHandler = null) must be compatible with PhpParser\Parser::parse(string $code, ?PhpParser\ErrorHandler $errorHandler = null): ?array in /app/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php on line 158
Relevant part of my composer.json:
{ "name": "phpstan/phpdoc-parser", "version": "1.32.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", "reference": "6ca22b154efdd9e3c68c56f5d94670920a1c19a4" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6ca22b154efdd9e3c68c56f5d94670920a1c19a4", "reference": "6ca22b154efdd9e3c68c56f5d94670920a1c19a4", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { "doctrine/annotations": "^2.0", "nikic/php-parser": "^4.15",
The text was updated successfully, but these errors were encountered: