We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Conditions | 2 |
Paths | 1 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
24 | public function boot() |
||
25 | { |
||
26 | // User::observe(UserObserver::class); |
||
27 | |||
28 | // Extend the Validator class. |
||
29 | // To check the user age (minimum: 16) |
||
30 | \Validator::extend( |
||
31 | 'olderThan', function ($attributes, $value, $parameters) { |
||
32 | $minAge = (!empty($parameters)) ? (int) $parameters[ 0 ] : 16; |
||
33 | return \Carbon\Carbon::now()->diff(new \Carbon\Carbon($value))->y >= $minAge; |
||
|
|||
34 | } |
||
35 | ); |
||
36 | } |
||
37 | } |
||
38 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: