Skip to content

Commit 1f788c1

Browse files
committed
[rector] Rector fixes
1 parent 7bc815c commit 1f788c1

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

config/sets/phpunit120.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Rector\Config\RectorConfig;
66
use Rector\PHPUnit\PHPUnit120\Rector\CallLike\CreateStubOverCreateMockArgRector;
7-
use Rector\PHPUnit\PHPUnit120\Rector\Class_\AllowMockObjectsWithoutExpectationsAttributeRector;
87
use Rector\PHPUnit\PHPUnit120\Rector\Class_\AssertIsTypeMethodCallRector;
98
use Rector\PHPUnit\PHPUnit120\Rector\Class_\RemoveOverrideFinalConstructTestCaseRector;
109

rules/PHPUnit120/Rector/Class_/AllowMockObjectsWithoutExpectationsAttributeRector.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Rector\PHPUnit\PHPUnit120\Rector\Class_;
66

7+
use PhpParser\Node\Expr\MethodCall;
8+
use PhpParser\Node\Expr\PropertyFetch;
79
use PhpParser\Node;
810
use PhpParser\Node\Attribute;
911
use PhpParser\Node\AttributeGroup;
@@ -14,7 +16,6 @@
1416
use PHPStan\Reflection\ReflectionProvider;
1517
use Rector\Doctrine\NodeAnalyzer\AttributeFinder;
1618
use Rector\PhpParser\Node\BetterNodeFinder;
17-
use Rector\PhpParser\NodeFinder\PropertyFetchFinder;
1819
use Rector\PHPUnit\Enum\PHPUnitAttribute;
1920
use Rector\PHPUnit\Enum\PHPUnitClassName;
2021
use Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer;
@@ -204,10 +205,10 @@ private function shouldSkipClass(Class_ $class): bool
204205

205206
private function isClassMethodUsingMethodCallOnPropertyNamed(ClassMethod $classMethod, string $mockObjectPropertyName): bool
206207
{
207-
/** @var Node\Expr\MethodCall[] $methodCalls */
208-
$methodCalls = $this->betterNodeFinder->findInstancesOfScoped([$classMethod], [Node\Expr\MethodCall::class]);
208+
/** @var MethodCall[] $methodCalls */
209+
$methodCalls = $this->betterNodeFinder->findInstancesOfScoped([$classMethod], [MethodCall::class]);
209210
foreach ($methodCalls as $methodCall) {
210-
if (!$methodCall->var instanceof Node\Expr\PropertyFetch) {
211+
if (!$methodCall->var instanceof PropertyFetch) {
211212
continue;
212213
}
213214

@@ -224,7 +225,7 @@ private function isClassMethodUsingMethodCallOnPropertyNamed(ClassMethod $classM
224225

225226
private function shouldAddAttribute(array $missedTestMethodsByMockPropertyName): bool
226227
{
227-
foreach ($missedTestMethodsByMockPropertyName as $propertyName => $missedTestMethods) {
228+
foreach ($missedTestMethodsByMockPropertyName as $missedTestMethods) {
228229
// all test methods are using method calls on the mock property, so skip
229230
if (count($missedTestMethods) === 0) {
230231
continue;

0 commit comments

Comments
 (0)