| 1 | <?php |
||
| 2 | |||
| 3 | namespace Mpyw\EloquentHasByNonDependentSubquery; |
||
| 4 | |||
| 5 | use Illuminate\Database\Eloquent\Builder; |
||
| 6 | use Illuminate\Support\ServiceProvider; |
||
| 7 | |||
| 8 | class EloquentHasByNonDependentSubqueryServiceProvider extends ServiceProvider |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Register Eloquent\Builder::hasByNonDependentSubquery() macros. |
||
| 12 | */ |
||
| 13 | 25 | public function boot(): void |
|
| 14 | { |
||
| 15 | 25 | Builder::macro('hasByNonDependentSubquery', function ($relationMethod, ?callable ...$constraints): Builder { |
|
|
0 ignored issues
–
show
|
|||
| 16 | /** @var \Illuminate\Database\Eloquent\Builder $query */ |
||
| 17 | 21 | $query = $this; |
|
| 18 | 21 | return (new HasByNonDependentSubqueryMacro($query))->has($relationMethod, ...$constraints); |
|
| 19 | 25 | }); |
|
| 20 | 25 | Builder::macro('orHasByNonDependentSubquery', function ($relationMethod, ?callable ...$constraints): Builder { |
|
| 21 | /** @var \Illuminate\Database\Eloquent\Builder $query */ |
||
| 22 | 1 | $query = $this; |
|
| 23 | 1 | return (new HasByNonDependentSubqueryMacro($query))->orHas($relationMethod, ...$constraints); |
|
| 24 | 25 | }); |
|
| 25 | 25 | Builder::macro('doesntHaveByNonDependentSubquery', function ($relationMethod, ?callable ...$constraints): Builder { |
|
| 26 | /** @var \Illuminate\Database\Eloquent\Builder $query */ |
||
| 27 | 1 | $query = $this; |
|
| 28 | 1 | return (new HasByNonDependentSubqueryMacro($query))->doesntHave($relationMethod, ...$constraints); |
|
| 29 | 25 | }); |
|
| 30 | 25 | Builder::macro('orDoesntHaveByNonDependentSubquery', function ($relationMethod, ?callable ...$constraints): Builder { |
|
| 31 | /** @var \Illuminate\Database\Eloquent\Builder $query */ |
||
| 32 | 1 | $query = $this; |
|
| 33 | 1 | return (new HasByNonDependentSubqueryMacro($query))->orDoesntHave($relationMethod, ...$constraints); |
|
| 34 | 25 | }); |
|
| 35 | } |
||
| 36 | } |
||
| 37 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.