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