rector/packages/phpstan-static-type-mapper/src/TypeMapper/NeverTypeMapper.php
Tomas Votruba 351e59fa3b
Fix array type (#4058)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-08-29 16:20:27 +02:00

42 lines
962 B
PHP

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