Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
15 | protected static function bootRecordsActivity() |
||
16 | { |
||
17 | // Comprovar si no hi ha usuari logat. |
||
18 | if (auth()->guest()) return; |
||
|
|||
19 | |||
20 | foreach (static::getActivitiesToRecord() as $event) { |
||
21 | static::$event(function ($model) use ($event) { |
||
22 | $model->recordActivity($event); |
||
23 | }); |
||
24 | } |
||
25 | } |
||
26 | |||
73 |
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: