Closed dengyl2018 closed 4 months ago
Simply because it is not valid PHP code. Try to run it in PHP and you get almost the same parsing error syntax error, unexpected token ";", expecting "->" or "?->" or "{" or "["
: https://3v4l.org/vpiSi
That's right -- the right hand side of &
needs to be a "variable" (in a very specific sense that cannot be briefly explained) and (...)
is not a variable.
parse
$result = &($context->getPageData());
not ok,error:Fatal error: Uncaught PhpParser\Error: Syntax error, unexpected ';', expecting '[' or T_OBJECT_OPERATOR or T_NULLSAFE_OBJECT_OPERATOR or '{' on line 36 in /PhpParser/ParserAbstract.php:318 Stack trace:
0 /PhpParser/ParserAbstract.php(159): PhpParser\ParserAbstract->doParse()
1 /PhpParser/Parser/Multiple.php(51): PhpParser\ParserAbstract->parse('<?php\n/****...', Object(PhpParser\ErrorHandler\Throwing))
2 PhpParser/Parser/Multiple.php(32): PhpParser\Parser\Multiple->tryParse(Object(PhpParser\Parser\Php7), Object(PhpParser\ErrorHandler\Throwing), '<?php\n/****...')
3 php_parser.php(23): PhpParser\Parser\Multiple->parse('< in /PhpParser/ParserAbstract.php on line 318
for compare, parse
$a = $context->getPageData(); $result = &$a;
is ok