new-keyword-redefinable causes Parse error: syntax error, unexpected token "->"
wvega opened this issue · 1 comments
wvega commented
Thank you again for quickly fixing #126! I ran into a different problem after I tried 2.1.20 on my project.
Patchwork rewrites the following:
$test = new class(new TestClass()) {
};
as something like:
$test = new class\Patchwork\CallRerouting\getInstantiator(...)->instantiate() {
}
The spliceAllInstantiations()
removes the parenthesis around (new TestClass())
and produces an invalid anonymous class declaration:
patchwork/src/CodeManipulation/Actions/RedefinitionOfNew.php
Lines 44 to 46 in dbe712f
I believe the fix for this problem is to add T_CLASS
to the list of exceptions in hasExtraParentheses()
so I'll try to pen a PR with tests and that oneliner.
antecedent commented
Thank you for fixing this! This is now part of version 2.1.21.