-
Notifications
You must be signed in to change notification settings - Fork 45
Description
PHP 7.1 and above has nullable types.
Parser doesn`t recognize them.
Example:
Change the example function declaration at the bottom of demo.php and add nullable type:
function foo(?array $a) {
Effect:
PHP Fatal error: Uncaught RuntimeException: Unknown Expr Type NullableType in .../vendor/ircmaxell/php-cfg/lib/PHPCfg/Parser.php:799
Stack trace:
#0 .../vendor/ircmaxell/php-cfg/lib/PHPCfg/Parser.php(1253): PHPCfg\Parser->parseExprNode(Object(PhpParser\Node\NullableType))
#1 .../vendor/ircmaxell/php-cfg/lib/PHPCfg/Parser.php(95): PHPCfg\Parser->parseParameterList(Object(PHPCfg\Func), Array)
#2 .../vendor/ircmaxell/php-cfg/lib/PHPCfg/Parser.php(332): PHPCfg\Parser->parseFunc(Object(PHPCfg\Func), Array, Array, NULL)
#3 .../vendor/ircmaxell/php-cfg/lib/PHPCfg/Parser.php(146): PHPCfg\Parser->parseStmt_Function(Object(PhpParser\Node\Stmt\Function_))
#4 .../vendor/ircmaxell/php-cfg/lib/PHPCfg/Parser.php(132): PHPCfg\Parser->parseNode(Object(PhpParser\Node\Stmt\Function_))
#5 .../vendor/ircmaxell/php-cfg/lib/PHPCfg/Parser.php(100): PHPCfg\Parser-> in .../vendor/ircmaxell/php-cfg/lib/PHPCfg/Parser.php on line 799