Skip to content

Commit bb11403

Browse files
phpstan-botclaude
andcommitted
Address review: add IntersectionType comment in DateTimeModifyReturnTypeExtension
Restore TypeTraverser approach (TypeCombinator::intersect creates Bar&DateTimeInterface intersections instead of filtering them out). Add explicit comment explaining that IntersectionType is evaluated as a whole via isSuperTypeOf and doesn't need special traversal. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b1bfeb2 commit bb11403

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Type/Php/DateTimeModifyReturnTypeExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ static function (Type $type, callable $traverse) use ($dateTimeInterfaceType): T
9494
if ($type instanceof UnionType) {
9595
return $traverse($type);
9696
}
97+
// IntersectionType and other composite types are evaluated
98+
// as a whole via isSuperTypeOf — no need to traverse into them
9799
if ($dateTimeInterfaceType->isSuperTypeOf($type)->yes()) {
98100
return $type;
99101
}

0 commit comments

Comments
 (0)