1 | <?php |
||
17 | class TrendDatePeriod |
||
18 | { |
||
19 | /* ----------------------------------------------------------------- |
||
20 | | Main Methods |
||
21 | | ----------------------------------------------------------------- |
||
22 | */ |
||
23 | |||
24 | /** |
||
25 | * Make date period (range) for the trend metric. |
||
26 | * |
||
27 | * @param \Cake\Chronos\Chronos $start |
||
28 | * @param \Cake\Chronos\Chronos $end |
||
29 | * @param string $unit |
||
30 | * @param mixed|null $timezone |
||
31 | * |
||
32 | * @return \Illuminate\Support\Collection |
||
33 | */ |
||
34 | 60 | public static function make(Chronos $start, Chronos $end, string $unit, $timezone = null) |
|
55 | |||
56 | /** |
||
57 | * Get the starting date. |
||
58 | * |
||
59 | * @param string $unit |
||
60 | * @param mixed|null $range |
||
61 | * |
||
62 | * @return \Cake\Chronos\Chronos |
||
63 | */ |
||
64 | 60 | public static function getStartingDate(string $unit, $range = null): Chronos |
|
93 | |||
94 | /* ----------------------------------------------------------------- |
||
95 | | Other Methods |
||
96 | | ----------------------------------------------------------------- |
||
97 | */ |
||
98 | |||
99 | /** |
||
100 | * Get next date. |
||
101 | * |
||
102 | * @param string $unit |
||
103 | * @param \Cake\Chronos\Chronos $next |
||
104 | * |
||
105 | * @return \Cake\Chronos\Chronos |
||
106 | */ |
||
107 | 60 | private static function getNextDate(string $unit, Chronos $next): Chronos |
|
129 | } |
||
130 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.