parser-reflection icon indicating copy to clipboard operation
parser-reflection copied to clipboard

ReflectionException "Could not find handler (..) resolveExprUnaryMinus method" for parameters like $foo-

Open marcovtwout opened this issue 1 year ago • 1 comments

On latest master, when parsing a class method that has a signature like this:

public function bar($foo = -1)

An exception is thrown when processing the node for $foo:

Go\ParserReflection\ReflectionException : Could not find handler for the Go\ParserReflection\Resolver\NodeExpressionResolver::resolveExprUnaryMinus method
 \src\Resolver\NodeExpressionResolver.php:171
 \src\Resolver\NodeExpressionResolver.php:150
 \src\ReflectionParameter.php:104

The node is of type PhpParser\Node\Expr\UnaryMinus

marcovtwout avatar Jul 11 '24 07:07 marcovtwout

Hm, nice, really missed this part

lisachenko avatar Jul 12 '24 06:07 lisachenko

We have same problem (resolveExprUnaryMinus). And another similar error: Could not find handler for the Go\ParserReflection\Resolver\NodeExpressionResolver::resolveExprArrayDimFetch method

alx-xc avatar Nov 25 '24 15:11 alx-xc

Merged into the master branch support for the UnaryMinus/UnaryPlus expressions.

lisachenko avatar Nov 25 '24 15:11 lisachenko

@alx-xc

We have same problem (resolveExprUnaryMinus). And another similar error: Could not find handler for the Go\ParserReflection\Resolver\NodeExpressionResolver::resolveExprArrayDimFetch method

Could you please open a separate issue or send me a small PR for this (ideally with test) to merge into the main branch?

lisachenko avatar Nov 25 '24 15:11 lisachenko