Skip to content

Commit 205928f

Browse files
committed
Revert "Consider static<T, U> same as static when the template types match"
This reverts commit e242091.
1 parent e242091 commit 205928f

File tree

3 files changed

+0
-83
lines changed

3 files changed

+0
-83
lines changed

src/PhpDoc/TypeNodeResolver.php

-24
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
use PHPStan\Type\FloatType;
6666
use PHPStan\Type\Generic\GenericClassStringType;
6767
use PHPStan\Type\Generic\GenericObjectType;
68-
use PHPStan\Type\Generic\TemplateType;
6968
use PHPStan\Type\Generic\TemplateTypeVariance;
7069
use PHPStan\Type\Helper\GetTemplateTypeType;
7170
use PHPStan\Type\IntegerRangeType;
@@ -759,29 +758,6 @@ static function (string $variance): TemplateTypeVariance {
759758

760759
$classReflection = $this->getReflectionProvider()->getClass($mainTypeClassName);
761760
if ($classReflection->isGeneric()) {
762-
if ($mainTypeName === 'static') {
763-
$templateTags = $classReflection->getTemplateTags();
764-
$templateTypeMap = $classReflection->getTemplateTypeMap();
765-
if (count($genericTypes) === $templateTypeMap->count()) {
766-
$templateTypeList = $classReflection->typeMapToList($templateTypeMap);
767-
foreach ($genericTypes as $i => $genericType) {
768-
if (!$genericType instanceof TemplateType) {
769-
break;
770-
}
771-
$templateType = $templateTypeList[$i];
772-
if (!$templateType instanceof TemplateType) {
773-
break;
774-
}
775-
if ($templateType->getName() !== $genericType->getName()) {
776-
break;
777-
}
778-
unset($templateTags[$genericType->getName()]);
779-
}
780-
if (count($templateTags) === 0) {
781-
return new StaticType($classReflection);
782-
}
783-
}
784-
}
785761
if (in_array($mainTypeClassName, [
786762
Traversable::class,
787763
IteratorAggregate::class,

tests/PHPStan/Analyser/NodeScopeResolverTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ public function dataFileAsserts(): iterable
149149
yield from $this->gatherAssertTypes(__DIR__ . '/../Reflection/data/staticReturnType.php');
150150

151151
yield from $this->gatherAssertTypes(__DIR__ . '/data/minmax.php');
152-
yield from $this->gatherAssertTypes(__DIR__ . '/data/consistent-static.php');
153152
if (PHP_VERSION_ID < 80000) {
154153
yield from $this->gatherAssertTypes(__DIR__ . '/data/minmax-arrays.php');
155154
}

tests/PHPStan/Analyser/data/consistent-static.php

-58
This file was deleted.

0 commit comments

Comments
 (0)