Skip to content

Commit a245a64

Browse files
committed
Revert "ConstantArrayType: fix returned ConstantArrayTypeAndMethod"
This reverts commit 13f6406.
1 parent b102d98 commit a245a64

File tree

2 files changed

+1
-32
lines changed

2 files changed

+1
-32
lines changed

src/Type/Constant/ConstantArrayType.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@ public function getCallableParametersAcceptors(ClassMemberAccessAnswerer $scope)
499499
}
500500

501501
$method = $typeAndMethodName->getType()
502-
->getObjectTypeOrClassStringObjectType()
503502
->getMethod($typeAndMethodName->getMethod(), $scope);
504503

505504
if (!$scope->canCallMethod($method)) {
@@ -584,7 +583,7 @@ public function findTypeAndMethodNames(): array
584583
$has = $has->and(TrinaryLogic::createMaybe());
585584
}
586585

587-
$typeAndMethods[] = ConstantArrayTypeAndMethod::createConcrete($classOrObject, $method->getValue(), $has);
586+
$typeAndMethods[] = ConstantArrayTypeAndMethod::createConcrete($type, $method->getValue(), $has);
588587
}
589588

590589
return $typeAndMethods;

tests/PHPStan/Type/Constant/ConstantArrayTypeTest.php

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,34 +1051,4 @@ public function testValuesArray(ConstantArrayType $type, ConstantArrayType $expe
10511051
$this->assertSame($expectedType->getNextAutoIndexes(), $actualType->getNextAutoIndexes());
10521052
}
10531053

1054-
public function testFindTypeAndMethodNames(): void
1055-
{
1056-
$classStringArray = new ConstantArrayType([
1057-
new ConstantIntegerType(0),
1058-
new ConstantIntegerType(1),
1059-
], [
1060-
new ConstantStringType(Closure::class, true),
1061-
new ConstantStringType('bind'),
1062-
]);
1063-
$objectArray = new ConstantArrayType([
1064-
new ConstantIntegerType(0),
1065-
new ConstantIntegerType(1),
1066-
], [
1067-
new ObjectType(Closure::class, null, $this->createReflectionProvider()->getClass(Closure::class)),
1068-
new ConstantStringType('bind'),
1069-
]);
1070-
1071-
$classStringResult = $classStringArray->findTypeAndMethodNames();
1072-
$objectResult = $objectArray->findTypeAndMethodNames();
1073-
1074-
$this->assertCount(1, $classStringResult);
1075-
$this->assertCount(1, $objectResult);
1076-
$this->assertInstanceOf(ConstantStringType::class, $classStringResult[0]->getType());
1077-
$this->assertInstanceOf(ObjectType::class, $objectResult[0]->getType());
1078-
$this->assertSame('bind', $classStringResult[0]->getMethod());
1079-
$this->assertSame('bind', $objectResult[0]->getMethod());
1080-
$this->assertSame(TrinaryLogic::createYes(), $classStringResult[0]->getCertainty());
1081-
$this->assertSame(TrinaryLogic::createYes(), $objectResult[0]->getCertainty());
1082-
}
1083-
10841054
}

0 commit comments

Comments
 (0)