Skip to content

Add breaking changes to L11 Upgrade Guide #10274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

clarkewing
Copy link

This PR seeks to improve the Laravel 11 Upgrade Guide by documenting the breaking changes introduced in laravel/framework#49642.

It suggests macros for applications which require seeded shuffles.

This PR seeks to improve the Laravel 11 Upgrade Guide by documenting the breaking changes introduced in laravel/framework#49642.

It suggests macros for applications which require seeded shuffles.
use Illuminate\Support\Collection;

Arr::macro('shuffleWithSeed', function (array $array, ?int $seed = null): array {
if (is_null($seed)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can avoid using a function here:

Suggested change
if (is_null($seed)) {
if ($seed === null) {

@taylorotwell
Copy link
Member

I'm not sure entirely we should recommend this as it could be insecure.

@clarkewing
Copy link
Author

@taylorotwell Would you be open to merging if I were to remove the recommended macros?
Users could then figure this part out themselves should they require it in non security-sensitive areas of their apps (predictably shuffling quiz answers is an example in an app I'm working on).

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