rector/packages/PHPStanStaticTypeMapper/TypeMapper/NeverTypeMapper.php

39 lines
909 B
PHP

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