phpqa icon indicating copy to clipboard operation
phpqa copied to clipboard

phpmetrics command with error

Open omrqs opened this issue 4 years ago • 4 comments

Warning: Undefined array key 314 in phar:///tools/.phive/phars/phpmetrics/phpmetrics-2.7.3.phar/vendor/nikic/php-parser/lib/PhpParser/Lexer.php on line 293

Fatal error: Uncaught TypeError: PhpParser\Lexer::getNextToken(): Return value must be of type int, null returned in phar:///tools/.phive/phars/phpmetrics/phpmetrics-2.7.3.phar/vendor/nikic/php-parser/lib/PhpParser/Lexer.php:333
Stack trace:
#0 phar:///tools/.phive/phars/phpmetrics/phpmetrics-2.7.3.phar/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php(208): PhpParser\Lexer->getNextToken('Symfony\\Bundle\\...', Array, Array)
#1 phar:///tools/.phive/phars/phpmetrics/phpmetrics-2.7.3.phar/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php(158): PhpParser\ParserAbstract->doParse()
#2 phar:///tools/.phive/phars/phpmetrics/phpmetrics-2.7.3.phar/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php(51): PhpParser\ParserAbstract->parse('<?php\n\ndeclare(...', Object(PhpParser\ErrorHandler\Throwing))
#3 phar:///tools/.phive/phars/phpmetrics/phpmetrics-2.7.3.phar/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php(32): PhpParser\Parser\Multiple->tryParse(Object(PhpParser\Parser\Php7), Object(PhpParser\ErrorHandler\Throwing), '<?php\n\ndeclare(...')
#4 phar:///tools/.phive/phars/phpmetrics/phpmetrics-2.7.3.phar/src/Hal/Application/Analyze.php(104): PhpParser\Parser\Multiple->parse('<?php\n\ndeclare(...')
#5 phar:///tools/.phive/phars/phpmetrics/phpmetrics-2.7.3.phar/src/Hal/Application/Application.php(57): Hal\Application\Analyze->run(Array)
#6 /tools/.phive/phars/phpmetrics/phpmetrics-2.7.3.phar(22): Hal\Application\Application->run(Array)
#7 {main}
  thrown in phar:///tools/.phive/phars/phpmetrics/phpmetrics-2.7.3.phar/vendor/nikic/php-parser/lib/PhpParser/Lexer.php on line 333

omrqs avatar Jun 08 '21 19:06 omrqs

How did you run phpmetrics? What arguments/options have you used?

Which phpqa image have you tried?

jakzal avatar Jun 09 '21 07:06 jakzal

i have the same issue, this is what i run:

  php-metrics:
    image: jakzal/phpqa:php8.0
    volumes:
      - ./:/project
    command: phpmetrics /project --report-html=./metrics/report --exclude=tests,vendor,var,.docker

ToGo101 avatar Jun 10 '21 11:06 ToGo101

This seems to be a problem with phpmetrics. See https://github.com/phpmetrics/PhpMetrics/issues/459

jakzal avatar Jun 10 '21 12:06 jakzal

Hi folks! I recently stumbled across this issue as well. It looks like this is a problem with php8, downgrading my phpmetrics pipeline to 7.4 solved the issue so at least there's a workaround for users experiencing this. I guess there's still some work to do to be php8 compatible.

siemendev avatar Nov 25 '21 11:11 siemendev