rector/packages/PHPStanStaticTypeMapper/TypeMapper/AccessoryNonEmptyStringTypeMapper.php
2022-06-06 16:43:29 +00:00

40 lines
1.2 KiB
PHP

<?php
declare (strict_types=1);
namespace RectorPrefix20220606\Rector\PHPStanStaticTypeMapper\TypeMapper;
use RectorPrefix20220606\PhpParser\Node;
use RectorPrefix20220606\PhpParser\Node\Name;
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use RectorPrefix20220606\PHPStan\PhpDocParser\Ast\Type\TypeNode;
use RectorPrefix20220606\PHPStan\Type\Accessory\AccessoryNonEmptyStringType;
use RectorPrefix20220606\PHPStan\Type\Type;
use RectorPrefix20220606\Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
/**
* @implements TypeMapperInterface<AccessoryNonEmptyStringType>
*/
final class AccessoryNonEmptyStringTypeMapper implements TypeMapperInterface
{
/**
* @return class-string<Type>
*/
public function getNodeClass() : string
{
return AccessoryNonEmptyStringType::class;
}
/**
* @param AccessoryNonEmptyStringType $type
*/
public function mapToPHPStanPhpDocTypeNode(Type $type, string $typeKind) : TypeNode
{
return new IdentifierTypeNode('string');
}
/**
* @param AccessoryNonEmptyStringType $type
*/
public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node
{
return new Name('string');
}
}