1 | <?php |
||
7 | final class XmlTransformer implements TransformerInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var int |
||
11 | */ |
||
12 | private $options; |
||
13 | |||
14 | /** |
||
15 | * @param int $options |
||
16 | */ |
||
17 | 3 | public function __construct($options = 0) |
|
18 | { |
||
19 | 3 | $this->options = $options; |
|
20 | 3 | } |
|
21 | |||
22 | /** |
||
23 | * @return string |
||
24 | */ |
||
25 | 1 | public function getContentType(): string |
|
29 | |||
30 | /** |
||
31 | * @param string $string |
||
32 | * |
||
33 | * @return array |
||
34 | * |
||
35 | * @throws TransformerException |
||
36 | */ |
||
37 | 2 | public function transform(string $string): array |
|
47 | |||
48 | /** |
||
49 | * @param \DOMElement $node |
||
50 | * |
||
51 | * @return array |
||
52 | */ |
||
53 | 1 | private function transformType(\DOMElement $node): array |
|
90 | |||
91 | /** |
||
92 | * @param \DOMElement $node |
||
93 | * |
||
94 | * @return string|int |
||
95 | */ |
||
96 | 1 | private function getKey(\DOMElement $node) |
|
109 | |||
110 | /** |
||
111 | * @param \DOMElement $node |
||
112 | * |
||
113 | * @return bool|string |
||
114 | */ |
||
115 | 1 | private function getValue(\DOMElement $node) |
|
127 | } |
||
128 |
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.