Skip to content

Commit a74d6fb

Browse files
SanderMullerclaude
andcommitted
Drop the variadic branch from the level-filtering callback
The callback only decides which members of the observed type findTypeToCheck() keeps, and this check uses that result for nothing but its ErrorType test - which the callback cannot influence, since filtering everything out falls back to the unfiltered type. Unpacking the element type in there therefore changed nothing: output is identical at levels 3, 5, 7, 8 and 9 on nullable, union, mixed and object-typed variadic by-ref parameters, which are the shapes where the callback is consulted at all. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 27771bf commit a74d6fb

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

‎src/Rules/Variables/ParameterOutTypeCheck.php‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,7 @@ public function check(
5757
$scope,
5858
$checkedExpr,
5959
'',
60-
static function (Type $type) use ($outType, $isVariadic): bool {
61-
if ($isVariadic) {
62-
$type = VariadicByRefParameterOutType::elementType($type);
63-
if ($type === null) {
64-
return false;
65-
}
66-
}
67-
68-
return $outType->isSuperTypeOf($type)->yes();
69-
},
60+
static fn (Type $type): bool => $outType->isSuperTypeOf($type)->yes(),
7061
);
7162
if ($typeResult->getType() instanceof ErrorType) {
7263
return $typeResult->getUnknownClassErrors();

0 commit comments

Comments
 (0)