[pkg-php-pear] Bug#850148: phpmd: Fatal error when using anonymous classes
Carsten Kosthorst
kosthorst at apobyte.de
Wed Jan 4 11:57:22 UTC 2017
Package: phpmd
Version: 2.4.3-1
Severity: important
Dear Maintainer,
phpmd does not seem to work with anonymous classes:
~$ cat foo.php && php foo.php && phpmd foo.php text cleancode
<?php
$foo = new class {
public function say($what) {
echo $what . PHP_EOL;
}
};
$foo->say("bar");
bar
PHP Fatal error: Uncaught TypeError: Argument 1 passed to PDepend\Source\AST\AbstractASTNode::addChild() must implement interface PDepend\Source\AST\ASTNode, instance of PDepend\Source\AST\ASTAnonymousClass given, called in /usr/share/php/PDepend/Source/Language/PHP/PHPParserVersion70.php on line 214 and defined in /usr/share/php/PDepend/Source/AST/AbstractASTNode.php:367
Stack trace:
#0 /usr/share/php/PDepend/Source/Language/PHP/PHPParserVersion70.php(214): PDepend\Source\AST\AbstractASTNode->addChild(Object(PDepend\Source\AST\ASTAnonymousClass))
#1 /usr/share/php/PDepend/Source/Language/PHP/PHPParserVersion70.php(188): PDepend\Source\Language\PHP\PHPParserVersion70->parseAnonymousClassDeclaration(Object(PDepend\Source\AST\ASTAllocationExpression))
#2 /usr/share/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(1475): PDepend\Source\Language\PHP\PHPParserVersion70->parseAllocationExpressionTypeReference(Object(PDepend\Source\AST\ASTAllocationExpression))
#3 /usr/share/php/PDepend/Source/Language/PHP/AbstractPHPParser.php in /usr/share/php/PDepend/Source/AST/AbstractASTNode.php on line 367
Carsten
-- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 4.8.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages phpmd depends on:
ii pdepend 2.2.4-1
ii php-cli 1:7.0+47
ii php-common 1:47
ii php7.0-cli [php-cli] 7.0.14-2
phpmd recommends no packages.
phpmd suggests no packages.
-- no debconf information
More information about the pkg-php-pear
mailing list