Larastan: When & Unless Validations

Created on 20 Mar 2021  Â·  4Comments  Â·  Source: nunomaduro/larastan

  • Larastan Version: 0.7.1
  • --level used: 5

Description

Parameter #2 $callback of method Illuminate\Database\Eloquent\Builder<App\Resource>::when() expects
(callable(Illuminate\Database\Eloquent\Builder<App\Resource>, mixed): null)|Illuminate\Database\Eloquent\Builder<App\Resource>,
Closure(Illuminate\Database\Eloquent\Builder): void given.

Laravel code where the issue was found

Resource::query()
    ->when($request->filled('stuff'), function ($query) use ($request) {
        $query->where('stuff', $request->input('stuff'));
    });

I believe instead of null return we should also return void
https://github.com/nunomaduro/larastan/commit/3b32c74a63ce36f85d5b0434725a59e0dcd74292#diff-cda4a8378b7ebd0f5aa8a5a9ae53a08e48d436e67928064bf28963f969dd93e0R192

Most helpful comment

Latest version

On Sat, Mar 20, 2021 at 1:45 AM Viktor Szépe @.*>
wrote:

Thank you.
What is your Larastan (this project) version?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/nunomaduro/larastan/issues/799#issuecomment-803255428,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AHZ2XFPXXTCNOZ6UNWF55WLTEQY7HANCNFSM4ZP6ZINA
.

All 4 comments

Thank you.
What is your Larastan (this project) version?

Latest version

On Sat, Mar 20, 2021 at 1:45 AM Viktor Szépe @.*>
wrote:

Thank you.
What is your Larastan (this project) version?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/nunomaduro/larastan/issues/799#issuecomment-803255428,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AHZ2XFPXXTCNOZ6UNWF55WLTEQY7HANCNFSM4ZP6ZINA
.

So what about this bug?

We welcome contributors.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Gummibeer picture Gummibeer  Â·  3Comments

iNviNho picture iNviNho  Â·  3Comments

danielcosta picture danielcosta  Â·  4Comments

grcasanova picture grcasanova  Â·  4Comments

fico7489 picture fico7489  Â·  3Comments