Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Illuminate/Collections/LazyCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ public static function make($items = [])
* @param int $from
* @param int $to
* @param int $step
* @return static<int, int>
* @return ($step is zero ? never : static<int, int>)
Copy link
Copy Markdown
Contributor

@shaedrich shaedrich Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what PHPStan has to say:

Condition "int is zero" in conditional return type is always false.
Method LazyCollection::range() has invalid return type zero.

https://phpstan.org/r/fe45d051-2850-4c2d-a04d-f359f58956f6

These are the supported integer ranges:

  • positive-int
  • negative-int
  • non-positive-int
  • non-negative-int
  • non-zero-int
  • int<0, 100>
  • int<min, 100>
  • int<50, max>

Similar to how strings can be a non-empty-string but not an empty-string, as they can be typed with a single literal: ''

Suggested change
* @return ($step is zero ? never : static<int, int>)
* @return ($step is 0 ? never : static<int, int>)

*
* @throws \InvalidArgumentException
*/
public static function range($from, $to, $step = 1)
{
Expand Down
Loading