mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-22 10:43:35 +01:00
Co-authored-by: rector-bot <tomas@getrector.org>
This commit is contained in:
parent
aae9a54768
commit
120e531084
@ -10,6 +10,7 @@ use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\If_;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use PHPStan\Type\ThisType;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\RectorDefinition\CodeSample;
|
||||
use Rector\Core\RectorDefinition\RectorDefinition;
|
||||
@ -81,6 +82,10 @@ CODE_SAMPLE
|
||||
}
|
||||
|
||||
$type = $scope->getType($node->var);
|
||||
if ($type instanceof ThisType) {
|
||||
$type = $type->getStaticObjectType();
|
||||
}
|
||||
|
||||
if (! $type instanceof ObjectType) {
|
||||
return null;
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\DeadCode\Tests\Rector\MethodCall\RemoveEmptyMethodCallRector\Fixture;
|
||||
|
||||
final class GeneratorStub
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->validateLineLengths();
|
||||
}
|
||||
|
||||
protected function validateLineLengths(): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\DeadCode\Tests\Rector\MethodCall\RemoveEmptyMethodCallRector\Fixture;
|
||||
|
||||
final class GeneratorStub
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
protected function validateLineLengths(): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\DeadCode\Tests\Rector\MethodCall\RemoveEmptyMethodCallRector\Fixture;
|
||||
|
||||
abstract class Validator
|
||||
{
|
||||
protected function validateLineLengths(): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
final class GeneratorStubUseAbstract extends Validator
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->validateLineLengths();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\DeadCode\Tests\Rector\MethodCall\RemoveEmptyMethodCallRector\Fixture;
|
||||
|
||||
abstract class Validator
|
||||
{
|
||||
protected function validateLineLengths(): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
final class GeneratorStubUseAbstract extends Validator
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\DeadCode\Tests\Rector\MethodCall\RemoveEmptyMethodCallRector\Fixture;
|
||||
|
||||
trait ValidatorTrait
|
||||
{
|
||||
protected function validateLineLengths(): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
final class GeneratorStubUseTrait
|
||||
{
|
||||
use ValidatorTrait;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->validateLineLengths();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user