Skip to content

Commit dcd58f9

Browse files
committed
[CodeQuality] Skip not match position named argumetn part 2
1 parent da01576 commit dcd58f9

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\ScalarArgumentToExpectedParamTypeRector\Fixture;
4+
5+
use PHPUnit\Framework\TestCase;
6+
7+
final class SkipNoTmatchPositionNamedArgument2 extends TestCase
8+
{
9+
public function testResizeHeight(): void
10+
{
11+
$this->createImage(width: 20, height: 40);
12+
}
13+
14+
public function createImage(
15+
string $content = 'content',
16+
int $width = 30,
17+
int $height = 50,
18+
int $resolution = 96
19+
): void {
20+
21+
}
22+
}

rules/CodeQuality/Reflection/MethodParametersAndReturnTypesResolver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ public function resolveCallParameterNames(MethodCall|StaticCall|New_ $callLike):
142142
$callerType = $this->nodeTypeResolver->getType(
143143
$callLike instanceof MethodCall ? $callLike->var : $callLike->class
144144
);
145+
146+
if ($callerType instanceof ThisType) {
147+
$callerType = $callerType->getStaticObjectType();
148+
}
149+
145150
if (! $callerType instanceof ObjectType) {
146151
return [];
147152
}

0 commit comments

Comments
 (0)