remove preslash custom type

This commit is contained in:
TomasVotruba 2020-05-05 22:12:38 +02:00
parent 94160332e1
commit ff8d50e93a
6 changed files with 4 additions and 25 deletions

View File

@ -1,16 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\BetterPhpDocParser\Type;
use PHPStan\Type\StringType;
use PHPStan\Type\VerbosityLevel;
final class PreSlashStringType extends StringType
{
public function describe(VerbosityLevel $verbosityLevel): string
{
return '\string';
}
}

View File

@ -80,7 +80,7 @@ final class ParamTypeResolver implements NodeTypeResolverInterface
return $this->resolveFromFunctionDocBlock($node);
}
private function resolveFromType(Node $node)
private function resolveFromType(Node $node): Type
{
if ($node->type !== null && ! $node->type instanceof Identifier) {
$resolveTypeName = $this->nodeNameResolver->getName($node->type);

View File

@ -41,7 +41,6 @@ final class ArrayTypeMapper implements PhpDocTypeMapperInterface
{
$nestedType = $this->phpDocTypeMapper->mapToPHPStanType($typeNode->type, $node, $nameScope);
// @todo improve for key!
return new ArrayType(new MixedType(), $nestedType);
}
}

View File

@ -16,6 +16,7 @@ use PHPStan\Type\StaticType;
use PHPStan\Type\Type;
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareIdentifierTypeNode;
use Rector\BetterPhpDocParser\Type\PreSlashStringType;
use Rector\Core\Exception\ShouldNotHappenException;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\PHPStan\Type\ParentStaticType;
use Rector\PHPStan\Type\SelfObjectType;
@ -60,11 +61,6 @@ final class IdentifierTypeMapper implements PhpDocTypeMapperInterface
$loweredName = strtolower($typeNode->name);
// @todo for all scalars
if ($loweredName === '\string') {
return new PreSlashStringType();
}
if ($loweredName === 'class-string') {
return new ClassStringType();
}

View File

@ -6,6 +6,6 @@ namespace Rector\PHPStanExtensions\Tests\Rule\SeeAnnotationToTestRule;
use PHPUnit\Framework\TestCase;
final class CorrectSeeRectorTest extends TestCase
final class CorrectSeeRector extends TestCase
{
}

View File

@ -10,7 +10,7 @@ use Rector\Core\Rector\AbstractRector;
use Rector\Core\RectorDefinition\RectorDefinition;
/**
* @see \Rector\PHPStanExtensions\Tests\Rule\SeeAnnotationToTestRule\CorrectSeeRectorTest
* @see \Rector\PHPStanExtensions\Tests\Rule\SeeAnnotationToTestRule\CorrectSeeRector
*/
final class CorrectSeeRector extends AbstractRector implements PhpRectorInterface
{