Warning: XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set

91 Views Asked by At

I need to test my code and coverage. I already install Xdebug extension What I have in my local is

PHP & xdebug version

PHP 8.1.20 (cli) (built: Jun 14 2023 05:48:10) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.20, Copyright (c) Zend Technologies
with Zend OPcache v8.1.20, Copyright (c), by Zend Technologies
with Xdebug v3.3.1, Copyright (c) 2002-2023, by Derick Rethans

Xdebug info

Enabled Features (through 'xdebug.mode' setting)  
Feature => Enabled/Disabled  
Development Helpers => ✔ enabled  
Coverage => ✘ disabled  
GC Stats => ✘ disabled  
Profiler => ✘ disabled  
Step Debugger => ✘ disabled  
Tracing => ✘ disabled  

PHPunit version PHPUnit 9.5.28 by Sebastian Bergmann and contributors.

Since I have not enabled the coverag, I am getting a message to enable the coverage.

After I enable the coverage, I am getting compatibility issue with "nikic/php-parser" package nikic/php-parser version is 4.x & this is the dependency package

[14-Mar-2024 16:28:52 UTC] 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 vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php on line 158

So I would like to know if there is any issue with Xdebug 3 & "nikic/php-parser" package

Note: I am using docker container and Symonfy framework

After enabling the coverage mode, my phpunit cases didn't execute as I got the compatibility issue with "nikic/php-parser" package

I tried updating the package & its dependent package, but no luck

If I disable the coverage, test cases are executing without any issues

Any lead would be really appreciable

0

There are 0 best solutions below