Skip to content

Commit dca7549

Browse files
committed
[ci-review] Rector Rectify
1 parent d5d13cb commit dca7549

File tree

8 files changed

+8
-15
lines changed

8 files changed

+8
-15
lines changed

src/PHPStanStaticTypeMapper/TypeMapper/IntegerTypeMapper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use PhpParser\Node;
88
use PhpParser\Node\Identifier;
99
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
10-
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
1110
use PHPStan\Type\IntegerType;
1211
use PHPStan\Type\Type;
1312
use Rector\Php\PhpVersionProvider;
@@ -32,7 +31,7 @@ public function getNodeClass(): string
3231
/**
3332
* @param IntegerType $type
3433
*/
35-
public function mapToPHPStanPhpDocTypeNode(Type $type): TypeNode
34+
public function mapToPHPStanPhpDocTypeNode(Type $type): IdentifierTypeNode
3635
{
3736
// note: cannot be handled by PHPStan as uses explicit values
3837
return new IdentifierTypeNode('int');

src/PHPStanStaticTypeMapper/TypeMapper/ThisTypeMapper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Rector\PHPStanStaticTypeMapper\TypeMapper;
66

7-
use PhpParser\Node;
87
use PhpParser\Node\Name;
98
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
109
use PHPStan\Type\ThisType;
@@ -32,7 +31,7 @@ public function mapToPHPStanPhpDocTypeNode(Type $type): TypeNode
3231
/**
3332
* @param ThisType $type
3433
*/
35-
public function mapToPhpParserNode(Type $type, string $typeKind): Node
34+
public function mapToPhpParserNode(Type $type, string $typeKind): Name
3635
{
3736
return new Name('self');
3837
}

src/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use PhpParser\Node\Name\FullyQualified;
1313
use PhpParser\Node\NullableType;
1414
use PhpParser\Node\UnionType as PhpParserUnionType;
15-
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
1615
use PHPStan\Type\ArrayType;
1716
use PHPStan\Type\MixedType;
1817
use PHPStan\Type\NeverType;
@@ -55,7 +54,7 @@ public function getNodeClass(): string
5554
/**
5655
* @param UnionType $type
5756
*/
58-
public function mapToPHPStanPhpDocTypeNode(Type $type): TypeNode
57+
public function mapToPHPStanPhpDocTypeNode(Type $type): BracketsAwareUnionTypeNode
5958
{
6059
$unionTypesNodes = [];
6160
$existingTypes = [];

src/PhpAttribute/AnnotationToAttributeMapper/ArrayAnnotationToAttributeMapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function isCandidate(mixed $value): bool
4141
/**
4242
* @param mixed[] $value
4343
*/
44-
public function map($value): Expr
44+
public function map($value): Array_
4545
{
4646
$arrayItems = [];
4747

src/PhpAttribute/AnnotationToAttributeMapper/StringAnnotationToAttributeMapper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Rector\PhpAttribute\AnnotationToAttributeMapper;
66

7-
use PhpParser\Node\Expr;
87
use PhpParser\Node\Scalar\String_;
98
use Rector\NodeTypeResolver\Node\AttributeKey;
109
use Rector\PhpAttribute\Contract\AnnotationToAttributeMapperInterface;
@@ -22,7 +21,7 @@ public function isCandidate(mixed $value): bool
2221
/**
2322
* @param string $value
2423
*/
25-
public function map($value): Expr
24+
public function map($value): String_
2625
{
2726
if (str_contains($value, "'") && ! str_contains($value, "\n")) {
2827
$kind = String_::KIND_DOUBLE_QUOTED;

src/PhpAttribute/AnnotationToAttributeMapper/StringNodeAnnotationToAttributeMapper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Rector\PhpAttribute\AnnotationToAttributeMapper;
66

7-
use PhpParser\Node\Expr;
87
use PhpParser\Node\Scalar\String_;
98
use Rector\BetterPhpDocParser\PhpDoc\StringNode;
109
use Rector\NodeTypeResolver\Node\AttributeKey;
@@ -23,7 +22,7 @@ public function isCandidate(mixed $value): bool
2322
/**
2423
* @param StringNode $value
2524
*/
26-
public function map($value): Expr
25+
public function map($value): String_
2726
{
2827
return new String_($value->value, [
2928
AttributeKey::KIND => $value->getAttribute(AttributeKey::KIND),

src/StaticTypeMapper/PhpParser/IntersectionTypeNodeMapper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use PhpParser\Node\Name;
99
use PhpParser\Node\Name\FullyQualified;
1010
use PHPStan\Type\IntersectionType;
11-
use PHPStan\Type\Type;
1211
use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface;
1312

1413
/**
@@ -31,7 +30,7 @@ public function getNodeType(): string
3130
/**
3231
* @param Node\IntersectionType $node
3332
*/
34-
public function mapToPHPStan(Node $node): Type
33+
public function mapToPHPStan(Node $node): IntersectionType
3534
{
3635
$types = [];
3736
foreach ($node->types as $intersectionedType) {

src/StaticTypeMapper/PhpParser/StringNodeMapper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use PhpParser\Node;
88
use PhpParser\Node\Scalar\String_;
99
use PHPStan\Type\StringType;
10-
use PHPStan\Type\Type;
1110
use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface;
1211

1312
/**
@@ -23,7 +22,7 @@ public function getNodeType(): string
2322
/**
2423
* @param String_ $node
2524
*/
26-
public function mapToPHPStan(Node $node): Type
25+
public function mapToPHPStan(Node $node): StringType
2726
{
2827
return new StringType();
2928
}

0 commit comments

Comments
 (0)