Skip to content
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

[10.x] Change Arr::sortRecursiveDesc() method to static. #48327

Merged

Conversation

gkisiel
Copy link
Contributor

@gkisiel gkisiel commented Sep 7, 2023

This PR makes the Arr::sortRecursiveDesc() method static, which it should be.

@gkisiel gkisiel changed the title [10.x] Change Arr:sortRecursiveDesc() method to static. [10.x] Change Arr::sortRecursiveDesc() method to static. Sep 7, 2023
@driesvints
Copy link
Member

Please add more reasoning why this is needed.

@gkisiel
Copy link
Contributor Author

gkisiel commented Sep 7, 2023

Using the folllowing code

$array = [
    ['Roman', 'Taylor', 'Li'],
    ['PHP', 'Ruby', 'JavaScript'],
    ['one' => 1, 'two' => 2, 'three' => 3],
];
 
$sorted = Arr::sortRecursiveDesc($array);

causes PHP parser error:

Non-static method Illuminate\Support\Arr::sortRecursiveDesc() cannot be called statically

The Arr::sortRecursiveDesc() method references another Arr::sortRecursive() method, which is a static method.

Edit: Was wrong example.

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