Skip to content

Commit

Permalink
[CodingStyle] Skip first class callable on UnSpreadOperatorRector (#4041
Browse files Browse the repository at this point in the history
)

* [CodingStyle] Skip first class callable on UnSpreadOperatorRector

* Fixed 🎉
  • Loading branch information
samsonasik committed Jun 1, 2023
1 parent 965b5f7 commit cfccdd0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Rector\Tests\CodingStyle\Rector\ClassMethod\UnSpreadOperatorRector\Fixture;

final class SkipFirstClassCallable
{
public function run(array $array): array {
return array_map(
callback: $this->callback(...),
array: $array,
);
}

private function callback(int $value): string {
return (string) $value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ private function refactorClassMethod(ClassMethod $classMethod): ?ClassMethod

private function refactorMethodCall(MethodCall $methodCall, Scope $scope): ?MethodCall
{
if ($methodCall->isFirstClassCallable()) {
return null;
}

$methodReflection = $this->reflectionResolver->resolveMethodReflectionFromMethodCall($methodCall);
if (! $methodReflection instanceof MethodReflection) {
return null;
Expand Down

0 comments on commit cfccdd0

Please sign in to comment.