skip non-existing method

This commit is contained in:
TomasVotruba 2020-06-10 20:50:00 +02:00
parent 5edcae8d69
commit 2ad9dd97e4
2 changed files with 16 additions and 0 deletions

View File

@ -95,6 +95,10 @@ PHP
[$class, $method] = $arrayCallable;
if (! method_exists($class, $method)) {
return null;
}
$methodReflection = new ReflectionMethod($class, $method);
if ($methodReflection->getNumberOfParameters() > 0) {
return null;

View File

@ -0,0 +1,12 @@
<?php
namespace Rector\CodeQuality\Tests\Rector\Array_\ArrayThisCallToThisMethodCallRector\Fixture;
class SkipNonExistingMethod
{
public function run()
{
$values = [1, 5, 3];
usort($values, [$this, 'compareSizeThat']);
}
}