Completed
Push — master ( d260a8...f09874 )
by Freek
01:42
created

src/macros/prioritize.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
use Illuminate\Support\Collection;
4
5
/*
6
 * Move elements to the start of the collection.
7
 *
8
 * @param  callable  $callable
9
 *
10
 * @return \Illuminate\Support\Collection
11
 */
12
Collection::macro('prioritize', function (callable $callable): Collection {
13
14
    $nonPrioritized = $this->reject($callable);
0 ignored issues
show
The variable $this does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
15
16
    return $this
17
        ->filter($callable)
18
        ->concat($nonPrioritized);
19
});
20