Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
39 | public static function logChanges(Model $subject, ?User $user): void |
||
40 | { |
||
41 | if ($subject->wasChanged()) { |
||
42 | $changed = $subject->getChanges(); |
||
43 | unset($changed['updated_at']); |
||
44 | $history = new self(); |
||
45 | $history->subject()->associate($subject); |
||
46 | $history->causer()->associate($user); |
||
|
|||
47 | $history->changed = $changed; |
||
48 | $history->save(); |
||
49 | } |
||
50 | } |
||
51 | } |
||
52 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: