Conditions | 4 |
Paths | 2 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | protected function asDateTime($value) |
||
19 | { |
||
20 | $datetime = parent::asDateTime($value); |
||
21 | |||
22 | $setAttributeCalled = Arr::first(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 30), function ($trace) { |
||
|
|||
23 | return $trace['function'] === 'setAttribute'; |
||
24 | }); |
||
25 | |||
26 | // When setting attributes, skip custom timezone setting, |
||
27 | // and use default application settings for consistent storage! |
||
28 | if (! $setAttributeCalled && app()->bound('request.user') && $timezone = optional(app('request.user'))->timezone) { |
||
29 | $datetime->setTimezone(new DateTimeZone($timezone)); |
||
30 | } |
||
31 | |||
32 | return $datetime; |
||
33 | } |
||
34 | } |
||
35 |
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: