1 | <?php |
||
10 | class OpenWeather implements OpenWeatherInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var Configuration |
||
14 | */ |
||
15 | private $config; |
||
16 | |||
17 | /** |
||
18 | * @var Client |
||
19 | */ |
||
20 | private $client; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $type; |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | private $supportedType = ['Weather', 'Forecast']; |
||
31 | |||
32 | /** |
||
33 | * OpenWeather constructor. |
||
34 | * @param string $type |
||
35 | * @param Configuration $config |
||
36 | */ |
||
37 | public function __construct($type, Configuration $config) |
||
49 | |||
50 | /** |
||
51 | * @param string $type |
||
52 | * @return bool |
||
53 | */ |
||
54 | private function isType($type) |
||
64 | |||
65 | /** |
||
66 | * @return array |
||
67 | */ |
||
68 | public function getSupportedType() |
||
72 | |||
73 | /** |
||
74 | * @param string $cityName |
||
75 | * @return ResponseInterface |
||
76 | */ |
||
77 | public function getByCityName($cityName) |
||
81 | |||
82 | /** |
||
83 | * @param string $cityId |
||
84 | * @return ResponseInterface |
||
85 | */ |
||
86 | public function getByCityId($cityId) |
||
90 | |||
91 | /** |
||
92 | * @param int $lat |
||
93 | * @param int $lon |
||
94 | * @return ResponseInterface |
||
95 | */ |
||
96 | public function getByGeographicCoordinates($lon, $lat) |
||
100 | |||
101 | /** |
||
102 | * @param array $parameters |
||
103 | * @return ResponseInterface |
||
104 | */ |
||
105 | private function request(array $parameters) |
||
112 | |||
113 | /** |
||
114 | * @param $requestType |
||
115 | * @return string |
||
116 | */ |
||
117 | private function buildUri($requestType) |
||
122 | |||
123 | /** |
||
124 | * @param $responseType |
||
125 | * @param Response $data |
||
126 | * @return ResponseInterface |
||
127 | */ |
||
128 | private function response($responseType, Response $data) |
||
133 | } |
||
134 |
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.