Skip to content

Commit

Permalink
array_is_list narrows the type even when not on Bleeding Edge
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jun 6, 2023
1 parent 8b1d78d commit de2566a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/PhpDoc/TypeNodeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,11 @@ private function resolveIdentifierTypeNode(IdentifierTypeNode $typeNode, NameSco
new ArrayType(new IntegerType(), new MixedType()),
new NonEmptyArrayType(),
));
case '__always-list':
return TypeCombinator::intersect(
new ArrayType(new IntegerType(), new MixedType()),
new AccessoryArrayListType(),
);

case 'empty':
$type = $this->tryResolvePseudoTypeClassType($typeNode, $nameScope);
Expand Down
2 changes: 1 addition & 1 deletion stubs/arrayFunctions.stub
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ function array_udiff(

/**
* @param array<array-key, mixed> $value
* @return ($value is list ? true : false)
* @return ($value is __always-list ? true : false)
*/
function array_is_list(array $value): bool {}

0 comments on commit de2566a

Please sign in to comment.