Skip to content

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

Merged
taylorotwell merged 1 commit into
laravel:10.xfrom
gkisiel:BUG-Arr-sortRecursiveDescToStatic
Sep 7, 2023
Merged

taylorotwell merged 1 commit into
laravel:10.xfrom
gkisiel:BUG-Arr-sortRecursiveDescToStatic

Conversation

@gkisiel

@gkisiel gkisiel commented Sep 7, 2023

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member

Please add more reasoning why this is needed.

@gkisiel

gkisiel commented Sep 7, 2023 •

Copy link
Copy Markdown
Contributor Author

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