Skip to content

Comments

[8.x] Add Support for custom Increment / Decrement in Collection range#39672

Closed
ManojKiranA wants to merge 3 commits intolaravel:8.xfrom
ManojKiranA:collection-range
Closed

[8.x] Add Support for custom Increment / Decrement in Collection range#39672
ManojKiranA wants to merge 3 commits intolaravel:8.xfrom
ManojKiranA:collection-range

Conversation

@ManojKiranA
Copy link
Contributor

By default php range function will accept 3rd argument for increment/decrement between elements in the sequence.

Since Collection::range function uses native php function I have added support for 3rd argument.

Before:

collect(range(2,10,2));

After:

collect()->range(2,10,2);

@ManojKiranA ManojKiranA changed the title Collection range Add Support for custom Increment / Decrement in Collection range Nov 18, 2021
@GrahamCampbell GrahamCampbell changed the title Add Support for custom Increment / Decrement in Collection range [8.x] Add Support for custom Increment / Decrement in Collection range Nov 18, 2021
*
* @param int $from
* @param int $to
* @param int|float $from
Copy link
Collaborator

Choose a reason for hiding this comment

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

👎 for allowing floats here. What was the use case?

@driesvints
Copy link
Member

This PR contains breaking changes to the method signature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants