parser-reflection
parser-reflection copied to clipboard
Unary minus value expr isn't resolved correctly in NodeExpressionResolver
Given code:
class Test
{
const A = -5;
protected $a = -5;
public function test($a = -5)
{}
}
All of these value cannot be parsed correctly in the current version (v3.0.1).
The values of all elements are parsed as "NULL".
The problem can be found in the NodeExpressionResolver. Negativ values are parsed as UnaryMinus with an expression inside. But at the moment there is no "resolveExprUnaryMinus" method and so these nodes are completely ignored.
The same counts for an unary plus. But in most cases you would never write an unary plus before positive numbers (at least I never did it or have seen it).
The inspection completed: 2 updated code elements
The inspection completed: No new issues