Conditions | 4 |
Paths | 5 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
51 | public function run(string $url): Result |
||
52 | { |
||
53 | $result = new Result($url); |
||
54 | $feed = (new Feed())->setUrl($url); |
||
55 | try { |
||
56 | /** @var CheckInterface $check */ |
||
57 | foreach ($this->checks as $check) { |
||
58 | if (!$check->perform($this->feedIo, $feed, $result)) { |
||
|
|||
59 | $result->setNotAccessible(); |
||
60 | return $result; |
||
61 | } |
||
62 | } |
||
63 | } catch (\Throwable $exception) { |
||
64 | $result->setNotAccessible(); |
||
65 | return $result; |
||
66 | } |
||
67 | |||
68 | |||
69 | return $result; |
||
70 | } |
||
71 | } |
||
72 |
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.