Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Type/Constant/ConstantArrayType.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ private function findTypeAndMethodName(): ?ConstantArrayTypeAndMethod
return ConstantArrayTypeAndMethod::createUnknown();
}

if ($classOrObject instanceof ConstantStringType && $classOrObject->isClassString()) {
if ($classOrObject instanceof ConstantStringType) {
$broker = Broker::getInstance();
if (!$broker->hasClass($classOrObject->getValue())) {
return ConstantArrayTypeAndMethod::createUnknown();
Expand Down
5 changes: 0 additions & 5 deletions src/Type/Constant/ConstantStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ public function getValue(): string
return $this->value;
}

public function isClassString(): bool
{
return $this->isClassString;
}

public function describe(VerbosityLevel $level): string
{
return $level->handle(
Expand Down
8 changes: 2 additions & 6 deletions tests/PHPStan/Type/Constant/ConstantArrayTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ public function testResolveTemplateTypes(Type $received, Type $template, array $

/**
* @dataProvider dataIsCallable
* @group solo
*/
public function testIsCallable(ConstantArrayType $type, TrinaryLogic $expectedResult): void
{
Expand Down Expand Up @@ -641,18 +640,15 @@ public function dataIsCallable(): iterable
TrinaryLogic::createNo(),
];

/**
* @see https://github.com/phpstan/phpstan/issues/3428
*/
yield 'existing static method but not a class string' => [
new ConstantArrayType([
new ConstantIntegerType(0),
new ConstantIntegerType(1),
], [
new ConstantStringType('Closure'),
new ConstantStringType('foobar'),
new ConstantStringType('bind'),
]),
TrinaryLogic::createMaybe(),
TrinaryLogic::createYes(),
];

yield 'existing static method but with string keys' => [
Expand Down