[Transform] Skip different method on CallableInMethodCallToVariableRector (#2395)

* [Transform] Skip different method on CallableInMethodCallToVariableRector

* [Transform] Skip different method on CallableInMethodCallToVariableRector

* [Transform] Skip different method on CallableInMethodCallToVariableRector

* Fixed 🎉

* cs

* fix code analysis dev
This commit is contained in:
Abdul Malik Ikhsan 2022-05-30 21:06:38 +07:00 committed by GitHub
parent 7df41da055
commit 0dc9777f46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 2 deletions

View File

@ -25,5 +25,7 @@ jobs:
rm phpstan-for-rector.neon
touch phpstan-for-rector.neon
- run: composer install --no-progress --ansi --no-dev
- run: bin/rector list --ansi
- run: |
composer install --ansi
composer install --no-progress --ansi --no-dev
- run: bin/rector list --ansi

View File

@ -0,0 +1,16 @@
<?php
namespace Rector\Tests\Transform\Rector\MethodCall\CallableInMethodCallToVariableRector\Fixture;
use Rector\Tests\Transform\Rector\MethodCall\CallableInMethodCallToVariableRector\Source\DummyCache;
final class SkipDifferentMethod
{
public function run(DummyCache $dummyCache, $someValue)
{
$dummyCache->load('key', function ($someValue) {
$someValue= $someValue + 1000;
return $someValue + 10;
});
}
}

View File

@ -86,6 +86,13 @@ CODE_SAMPLE
continue;
}
if (! $this->nodeNameResolver->isName(
$node->name,
$singleCallableInMethodCallToVariable->getMethodName()
)) {
continue;
}
$position = $singleCallableInMethodCallToVariable->getArgumentPosition();
if (! isset($node->args[$position])) {
continue;