Skip to content

Commit 035e89f

Browse files
zonuexestaabm
authored andcommitted
Resolve the class-string object type without a TrinaryLogic check
getClassStringObjectType() returns an ErrorType for non-class-string types, so the isClassString()->yes() guard was redundant. Dropping it also removes an escaped TrinaryLogic mutant reported by mutation testing.
1 parent 2e4c4af commit 035e89f

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

‎src/Type/Php/GetParentClassDynamicFunctionReturnTypeExtension.php‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,12 @@ public function getTypeFromFunctionCall(
6767
}
6868

6969
// A `static::class` string refers to the same late-static-bound type as `$this`/`static`,
70-
// so unwrap it and reuse the object handling below.
70+
// so unwrap it and reuse the object handling below. Non-class-string types resolve to
71+
// an ErrorType here, so they are left alone.
7172
$valueType = $argType;
72-
if ($argType->isClassString()->yes()) {
73-
$classStringObjectType = $argType->getClassStringObjectType();
74-
if ($classStringObjectType instanceof StaticType) {
75-
$valueType = $classStringObjectType;
76-
}
73+
$classStringObjectType = $argType->getClassStringObjectType();
74+
if ($classStringObjectType instanceof StaticType) {
75+
$valueType = $classStringObjectType;
7776
}
7877

7978
// Inside a trait a late-static-bound value cannot be resolved to a concrete parent,

0 commit comments

Comments
 (0)