Skip to content

Commit f821644

Browse files
committed
fix
1 parent b6f27f0 commit f821644

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

rules-tests/CodeQuality/Rector/MethodCall/WithCallbackIdenticalToStandaloneAssertsRector/Fixture/on_self.php.inc

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ declare(strict_types=1);
55
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\WithCallbackIdenticalToStandaloneAssertsRector\Fixture;
66

77
use PHPUnit\Framework\TestCase;
8-
use Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\WithCallbackIdenticalToStandaloneAssertsRector\Source\SomeClassWithMethodCall;
98

109
final class OnSelf extends TestCase
1110
{
@@ -19,4 +18,30 @@ final class OnSelf extends TestCase
1918
}
2019
}
2120

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+
2247
?>

rules/CodeQuality/NodeFactory/FromBinaryAndAssertExpressionsFactory.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)