mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-07 03:40:50 +00:00
bdfd24339f
2e977bd3aa
deploy to original repository
41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\PHPStanStaticTypeMapper\TypeMapper;
|
|
|
|
use PhpParser\Node;
|
|
use PhpParser\Node\Name;
|
|
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
|
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
|
use PHPStan\Type\Type;
|
|
use Rector\Core\Enum\ObjectReference;
|
|
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
|
|
use Rector\StaticTypeMapper\ValueObject\Type\ParentStaticType;
|
|
/**
|
|
* @implements TypeMapperInterface<ParentStaticType>
|
|
*/
|
|
final class ParentStaticTypeMapper implements TypeMapperInterface
|
|
{
|
|
/**
|
|
* @return class-string<Type>
|
|
*/
|
|
public function getNodeClass() : string
|
|
{
|
|
return ParentStaticType::class;
|
|
}
|
|
/**
|
|
* @param ParentStaticType $type
|
|
*/
|
|
public function mapToPHPStanPhpDocTypeNode(Type $type, string $typeKind) : TypeNode
|
|
{
|
|
return new IdentifierTypeNode(ObjectReference::PARENT);
|
|
}
|
|
/**
|
|
* @param ParentStaticType $type
|
|
*/
|
|
public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node
|
|
{
|
|
return new Name(ObjectReference::PARENT);
|
|
}
|
|
}
|