Skip to content
Open
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
3 changes: 3 additions & 0 deletions src/Type/Generic/GenericClassStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@
if ($type instanceof ConstantStringType) {
$genericType = $this->type;
if ($genericType instanceof MixedType) {
if (!$type->isClassString()->yes()) {

Check warning on line 97 in src/Type/Generic/GenericClassStringType.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.3, ubuntu-latest)

Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ if ($type instanceof ConstantStringType) { $genericType = $this->type; if ($genericType instanceof MixedType) { - if (!$type->isClassString()->yes()) { + if ($type->isClassString()->no()) { return IsSuperTypeOfResult::createMaybe(); } return IsSuperTypeOfResult::createYes();

Check warning on line 97 in src/Type/Generic/GenericClassStringType.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.4, ubuntu-latest)

Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ if ($type instanceof ConstantStringType) { $genericType = $this->type; if ($genericType instanceof MixedType) { - if (!$type->isClassString()->yes()) { + if ($type->isClassString()->no()) { return IsSuperTypeOfResult::createMaybe(); } return IsSuperTypeOfResult::createYes();
return IsSuperTypeOfResult::createMaybe();
}
return IsSuperTypeOfResult::createYes();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2817,4 +2817,9 @@ public function testBug14312b(): void
$this->analyse([__DIR__ . '/data/bug-14312b.php'], []);
}

public function testBug10076(): void
{
$this->analyse([__DIR__ . '/data/bug-10076.php'], []);
}

}
20 changes: 20 additions & 0 deletions tests/PHPStan/Rules/Functions/data/bug-10076.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Bug10076;

/**
* @template T
*
* @param 'object'|'array'|class-string<T> $type
*
* @return list<mixed>
*/
function result($type = 'object'): array
{
return [];
}

result();
result('object');
result('array');
result(\DateTime::class);
Loading