File tree Expand file tree Collapse file tree
rules-tests/Unambiguous/Rector/Expression/FluentSettersToStandaloneCallMethodRector/Fixture
rules/Unambiguous/Rector/Expression Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,8 +27,8 @@ final class SomeClass
2727 public function setup ()
2828 {
2929 $ someSetterClass = new SomeSetterClass ();
30- $ someSetterClass ->setSurname ('Doe ' );
3130 $ someSetterClass ->setName ('John ' );
31+ $ someSetterClass ->setSurname ('Doe ' );
3232 }
3333}
3434
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Rector \Tests \Unambiguous \Rector \Expression \FluentSettersToStandaloneCallMethodRector \Fixture ;
4+
5+ use PHPUnit \Framework \TestCase ;
6+ use Rector \Tests \Unambiguous \Rector \Expression \FluentSettersToStandaloneCallMethodRector \Source \SomeSetterClass ;
7+
8+ final class SkipMocksOnVariable extends TestCase
9+ {
10+ public function test ()
11+ {
12+ $ someVariable = $ this ->createMock (SomeSetterClass::class);
13+ $ someVariable ->expects ($ this ->once ())
14+ ->method ('some ' )
15+ ->with (1 );
16+ }
17+ }
Original file line number Diff line number Diff line change 44
55namespace Rector \Unambiguous \Rector \Expression ;
66
7- use PHPStan \Type \ObjectType ;
87use PhpParser \Node ;
98use PhpParser \Node \Expr ;
109use PhpParser \Node \Expr \Assign ;
1514use PhpParser \Node \Stmt \Expression ;
1615use PhpParser \Node \Stmt \Return_ ;
1716use PHPStan \Reflection \ClassReflection ;
17+ use PHPStan \Type \ObjectType ;
1818use Rector \Naming \Naming \PropertyNaming ;
1919use Rector \NodeTypeResolver \Node \AttributeKey ;
2020use Rector \Rector \AbstractRector ;
@@ -119,6 +119,9 @@ public function refactor(Node $node): ?array
119119 $ firstAssign = new Assign ($ someVariable , $ rootExpr );
120120 $ stmts = [new Expression ($ firstAssign )];
121121
122+ // revert to normal order
123+ $ methodCalls = array_reverse ($ methodCalls );
124+
122125 foreach ($ methodCalls as $ methodCall ) {
123126 $ methodCall ->var = $ someVariable ;
124127 // inlines indent and removes () around first expr
You can’t perform that action at this time.
0 commit comments