File tree Expand file tree Collapse file tree 2 files changed +50
-1
lines changed
rules-tests/CodeQuality/Rector/MethodCall/WithCallbackIdenticalToStandaloneAssertsRector/Fixture
rules/CodeQuality/NodeFactory Expand file tree Collapse file tree 2 files changed +50
-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 \PHPUnit \Tests \CodeQuality \Rector \MethodCall \WithCallbackIdenticalToStandaloneAssertsRector \Fixture ;
6+
7+ use PHPUnit \Framework \TestCase ;
8+
9+ final class OnSelf extends TestCase
10+ {
11+ public function test ()
12+ {
13+ $ someMock = $ this ->getMockBuilder ('AnyType ' )->getMock ();
14+
15+ $ someMock ->expects ($ this ->any ())
16+ ->method ('trans ' )
17+ ->with ($ this ->callback (fn ($ arg ) => $ arg instanceof self && $ arg ->isReady ()));
18+ }
19+ }
20+
21+ ?>
22+ -----
23+ <?php
24+
25+ declare (strict_types=1 );
26+
27+ namespace Rector \PHPUnit \Tests \CodeQuality \Rector \MethodCall \WithCallbackIdenticalToStandaloneAssertsRector \Fixture ;
28+
29+ use PHPUnit \Framework \TestCase ;
30+
31+ final class OnSelf extends TestCase
32+ {
33+ public function test ()
34+ {
35+ $ someMock = $ this ->getMockBuilder ('AnyType ' )->getMock ();
36+
37+ $ someMock ->expects ($ this ->any ())
38+ ->method ('trans ' )
39+ ->with ($ this ->callback (function ($ arg ): bool {
40+ $ this ->assertInstanceOf (self ::class, $ arg );
41+ $ this ->assertTrue ($ arg ->isReady ());
42+ return true ;
43+ }));
44+ }
45+ }
46+
47+ ?>
Original file line number Diff line number Diff line change @@ -78,8 +78,10 @@ public function create(array $exprs): array
7878 }
7979
8080 if ($ expr instanceof Instanceof_) {
81- if ($ expr ->class instanceof Name ) {
81+ if ($ expr ->class instanceof FullyQualified ) {
8282 $ classNameExpr = new ClassConstFetch (new FullyQualified ($ expr ->class ->name ), 'class ' );
83+ } elseif ($ expr ->class instanceof Name) {
84+ $ classNameExpr = new ClassConstFetch (new Name ($ expr ->class ->name ), 'class ' );
8385 } else {
8486 $ classNameExpr = $ expr ->class ;
8587 }
You can’t perform that action at this time.
0 commit comments