1 | <?php |
||
8 | class Track |
||
9 | { |
||
10 | /** @var StatisticsSource */ |
||
11 | private $source; |
||
12 | |||
13 | /** |
||
14 | * Track constructor. |
||
15 | * |
||
16 | * @param StatisticsSource $statisticsSource |
||
17 | */ |
||
18 | public function __construct(StatisticsSource $statisticsSource) |
||
22 | |||
23 | /** |
||
24 | * @param string $name |
||
25 | * @param float $value |
||
26 | * @param \DateTimeInterface|null $datetime |
||
27 | */ |
||
28 | public function event(string $name, float $value, \DateTimeInterface $datetime = null) |
||
39 | |||
40 | /** |
||
41 | * @param array $events Should be formatted as "event_name" => "event_value" |
||
42 | * @param \DateTimeInterface|null $datetime |
||
43 | */ |
||
44 | public function events(array $events, \DateTimeInterface $datetime = null) |
||
55 | |||
56 | /** |
||
57 | * @param \DateTimeInterface|null $datetime |
||
58 | * @return \DateTimeInterface |
||
59 | */ |
||
60 | protected function datetime(\DateTimeInterface $datetime = null): \DateTimeInterface |
||
64 | |||
65 | protected function addEvent(string $name, float $value, \DateTimeInterface $datetime) |
||
74 | |||
75 | /** |
||
76 | * @param Statistics $record |
||
77 | * @param float $value |
||
78 | */ |
||
79 | protected function updateEvent(Statistics $record, float $value) |
||
84 | } |
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.