Skip to content

Commit

Permalink
Test changing type node for different type
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed May 29, 2023
1 parent 90cf56c commit 4e3883b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/PHPStan/Printer/PrinterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,27 @@ public function enterNode(Node $node)

},
];

yield [
'/** @var ArrayObject<int[]> */',
'/** @var ArrayObject<array<int>> */',
new class extends AbstractNodeVisitor {

public function enterNode(Node $node)
{
if ($node instanceof ArrayTypeNode) {
return new GenericTypeNode(new IdentifierTypeNode('array'), [
new IdentifierTypeNode('int'),
], [
GenericTypeNode::VARIANCE_INVARIANT,
]);
}

return $node;
}

},
];
}

/**
Expand Down

0 comments on commit 4e3883b

Please sign in to comment.