mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-24 11:44:14 +01:00
skip empty method on open-source
This commit is contained in:
parent
b6285b22f6
commit
40ab236fee
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\DeadCode\Tests\Rector\ClassMethod\RemoveUnusedParameterRector\FixtureOpenSource;
|
||||
|
||||
class SkipEmptyMethodToBeOverridden
|
||||
{
|
||||
public function foo(string $foo, string $bar)
|
||||
{
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user