skip empty method on open-source

This commit is contained in:
TomasVotruba 2020-03-01 23:42:35 +01:00
parent b6285b22f6
commit 40ab236fee
2 changed files with 24 additions and 0 deletions

View File

@ -223,6 +223,10 @@ PHP
return true;
}
if ($this->shouldSkipOpenSourceEmpty($classMethod)) {
return true;
}
return $this->isAnonymousClass($class);
}
@ -243,4 +247,14 @@ PHP
return $classMethod->isPublic();
}
private function shouldSkipOpenSourceEmpty(ClassMethod $classMethod): bool
{
// skip as possible contract for 3rd party
if (! $this->isOpenSourceProjectType()) {
return false;
}
return empty($classMethod->getStmts());
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace Rector\DeadCode\Tests\Rector\ClassMethod\RemoveUnusedParameterRector\FixtureOpenSource;
class SkipEmptyMethodToBeOverridden
{
public function foo(string $foo, string $bar)
{
}
}