Skip to content

Commit a4377e2

Browse files
phpstan-botclaude
andcommitted
Drop the tests/ ignore for TypeTraverserMapMemoizedRule
The callbacks in the three affected tests do not depend on where or how many times a Type instance occurs, so they use mapMemoized() like src/ does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 1fa5521 commit a4377e2

4 files changed

Lines changed: 3 additions & 7 deletions

File tree

‎build/phpstan.neon‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ parameters:
8181
- '#^Dynamic call to static method PHPUnit\\Framework\\\S+\(\)\.$#'
8282
- '#should be contravariant with parameter \$node \(PhpParser\\Node\) of method PHPStan\\Rules\\Rule<PhpParser\\Node>::processNode\(\)$#'
8383
- '#Variable property access on PhpParser\\Node#'
84-
-
85-
identifier: phpstanApi.typeTraverserMap
86-
path: ../tests/* # tests exercise TypeTraverser::map() itself
87-
reportUnmatched: false
8884
-
8985
identifier: shipmonk.deadMethod
9086
message: '#^Unused .*?::__construct#' # likely used in DIC

‎tests/PHPStan/Type/Generic/UnresolvedTemplateArgumentTypeTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function testTraverseAndGeneralizeKeepTheSite(): void
140140
$marker = self::marker($site, $outer);
141141

142142
$this->assertTrue($marker->hasTemplateOrLateResolvableType());
143-
$resolved = TypeTraverser::map($marker, static function (Type $type, callable $traverse) use ($outer): Type {
143+
$resolved = TypeTraverser::mapMemoized($marker, static function (Type $type, callable $traverse) use ($outer): Type {
144144
if ($type === $outer) {
145145
return new IntegerType();
146146
}

‎tests/PHPStan/Type/LateResolvableArrayShapeTypeTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public static function dataResolve(): iterable
221221
#[DataProvider('dataResolve')]
222222
public function testResolve(Type $type, Type $resolvedTemplateType, string $expectedDescription): void
223223
{
224-
$resolved = TypeTraverser::map($type, static function (Type $type, callable $traverse) use ($resolvedTemplateType): Type {
224+
$resolved = TypeTraverser::mapMemoized($type, static function (Type $type, callable $traverse) use ($resolvedTemplateType): Type {
225225
if ($type instanceof Generic\TemplateType) {
226226
return $resolvedTemplateType;
227227
}

‎tests/PHPStan/Type/TypeCombinatorTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5899,7 +5899,7 @@ public function testIntersectInversed(
58995899

59005900
private static function describeForIntersectTest(Type $type): string
59015901
{
5902-
$type = TypeTraverser::map($type, static function (Type $type, callable $traverse): Type {
5902+
$type = TypeTraverser::mapMemoized($type, static function (Type $type, callable $traverse): Type {
59035903
if ($type instanceof ConstantArrayType) {
59045904
return $traverse($type->sortKeys());
59055905
}

0 commit comments

Comments
 (0)