File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
rules-tests/CodeQuality/Rector/ClassMethod/OptionalParametersAfterRequiredRector/Fixture
src/NodeTypeResolver/PHPStan/Scope Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Rector \Tests \CodeQuality \Rector \ClassMethod \OptionalParametersAfterRequiredRector \Fixture ;
6+
7+ final class SkipFirstClassCallableInCall
8+ {
9+ public function getSubscribedEvents ()
10+ {
11+ return $ this ->textElement (...)->execute (...);
12+ }
13+
14+ public function textElement ()
15+ {
16+ }
17+ }
Original file line number Diff line number Diff line change 55namespace Rector \NodeTypeResolver \PHPStan \Scope ;
66
77use Error ;
8- use PHPStan \Node \Printer \Printer ;
98use PhpParser \Node ;
109use PhpParser \Node \Arg ;
1110use PhpParser \Node \ArrayItem ;
8887use PHPStan \Analyser \MutatingScope ;
8988use PHPStan \Analyser \NodeScopeResolver ;
9089use PHPStan \Analyser \ScopeContext ;
90+ use PHPStan \Node \MethodCallableNode ;
91+ use PHPStan \Node \Printer \Printer ;
9192use PHPStan \Node \UnreachableStatementNode ;
9293use PHPStan \Node \VirtualNode ;
9394use PHPStan \Parser \ParserErrorsException ;
@@ -384,6 +385,15 @@ public function processNodes(
384385 $ node ->cond ->setAttribute (AttributeKey::SCOPE , $ mutatingScope );
385386 return ;
386387 }
388+
389+ if ($ node instanceof MethodCallableNode) {
390+ $ node ->getOriginalNode ()
391+ ->setAttribute (AttributeKey::SCOPE , $ mutatingScope );
392+ $ node ->getOriginalNode ()
393+ ->var ->setAttribute (AttributeKey::SCOPE , $ mutatingScope );
394+ $ node ->getOriginalNode ()
395+ ->name ->setAttribute (AttributeKey::SCOPE , $ mutatingScope );
396+ }
387397 };
388398
389399 try {
You can’t perform that action at this time.
0 commit comments