Skip to content

Commit f54febd

Browse files
phpstan-botclaude
andcommitted
Simplify HasMethodType/HasPropertyType::isSuperTypeOf() CompoundType delegation
Now that string/scalar type queries return Maybe on HasMethodType and HasPropertyType, the fallback-on-No guard is no longer needed. The CompoundType delegation can unconditionally return the isSubTypeOf() result. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 56412dd commit f54febd

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

src/Type/Accessory/HasMethodType.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,7 @@ public function accepts(Type $type, bool $strictTypes): AcceptsResult
8383
public function isSuperTypeOf(Type $type): IsSuperTypeOfResult
8484
{
8585
if ($type instanceof CompoundType) {
86-
$result = $type->isSubTypeOf($this);
87-
if (!$result->no()) {
88-
return $result;
89-
}
86+
return $type->isSubTypeOf($this);
9087
}
9188

9289
return new IsSuperTypeOfResult($type->hasMethod($this->methodName), []);

src/Type/Accessory/HasPropertyType.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@ public function accepts(Type $type, bool $strictTypes): AcceptsResult
8080
public function isSuperTypeOf(Type $type): IsSuperTypeOfResult
8181
{
8282
if ($type instanceof CompoundType) {
83-
$result = $type->isSubTypeOf($this);
84-
if (!$result->no()) {
85-
return $result;
86-
}
83+
return $type->isSubTypeOf($this);
8784
}
8885

8986
return new IsSuperTypeOfResult(

0 commit comments

Comments
 (0)