mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-24 11:44:14 +01:00
Don't type hint to traits
This commit is contained in:
parent
1b2eeb177a
commit
559216cb0a
@ -10,10 +10,12 @@ use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\Core\RectorDefinition\CodeSample;
|
||||
use Rector\Core\RectorDefinition\RectorDefinition;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\PHPStan\Type\ShortenedObjectType;
|
||||
use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
|
||||
use Rector\TypeDeclaration\ChildPopulator\ChildParamPopulator;
|
||||
use Rector\TypeDeclaration\TypeInferer\ParamTypeInferer;
|
||||
@ -143,6 +145,16 @@ PHP
|
||||
return;
|
||||
}
|
||||
|
||||
if ($inferedType instanceof ObjectType) {
|
||||
$fqcn = $inferedType instanceof ShortenedObjectType
|
||||
? $inferedType->getFullyQualifiedName()
|
||||
: $inferedType->getClassName();
|
||||
$reflectionClass = new \ReflectionClass($fqcn);
|
||||
if ($reflectionClass->isTrait()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$paramTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode(
|
||||
$inferedType,
|
||||
PHPStanStaticTypeMapper::KIND_PARAM
|
||||
|
Loading…
x
Reference in New Issue
Block a user