Skip to content

Commit

Permalink
[StaticTypeMapper] Remove parent attribute on StaticTypeMapper (#4330)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jun 23, 2023
1 parent a9cb9a0 commit 0d2d1e3
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions packages/StaticTypeMapper/StaticTypeMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
use PhpParser\Node\ComplexType;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PhpParser\Node\Param;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\UnionType;
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
Expand All @@ -22,7 +20,6 @@
use PHPStan\Type\Type;
use Rector\Core\Exception\NotImplementedYetException;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
use Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper;
Expand Down Expand Up @@ -112,16 +109,7 @@ public function mapPHPStanPhpDocTypeToPHPStanType(PhpDocTagValueNode $phpDocTagV

public function mapPHPStanPhpDocTypeNodeToPHPStanType(TypeNode $typeNode, Node $node): Type
{
if ($node instanceof Param) {
$classMethod = $node->getAttribute(AttributeKey::PARENT_NODE);
if ($classMethod instanceof ClassMethod) {
// param does not hany any clue about template map, but class method has
$node = $classMethod;
}
}

$nameScope = $this->nameScopeFactory->createNameScopeFromNode($node);

return $this->phpDocTypeMapper->mapToPHPStanType($typeNode, $node, $nameScope);
}
}

0 comments on commit 0d2d1e3

Please sign in to comment.