1 | <?php |
||
29 | class URL{ |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $url; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $method; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $scheme; |
||
45 | |||
46 | /** |
||
47 | * @var string |
||
48 | */ |
||
49 | protected $host; |
||
50 | |||
51 | /** |
||
52 | * @var int |
||
53 | */ |
||
54 | protected $port; |
||
55 | |||
56 | /** |
||
57 | * @var string |
||
58 | */ |
||
59 | protected $path; |
||
60 | |||
61 | /** |
||
62 | * @var string |
||
63 | */ |
||
64 | protected $query; |
||
65 | |||
66 | /** |
||
67 | * @var string |
||
68 | */ |
||
69 | protected $fragment; |
||
70 | |||
71 | /** |
||
72 | * @var array |
||
73 | */ |
||
74 | protected $parsedquery = []; |
||
75 | |||
76 | /** |
||
77 | * @var array |
||
78 | */ |
||
79 | protected $params = []; |
||
80 | |||
81 | /** |
||
82 | * @var array |
||
83 | */ |
||
84 | protected $body = []; |
||
85 | |||
86 | /** |
||
87 | * URL constructor. |
||
88 | * |
||
89 | * @param string $url |
||
90 | * @param array $params |
||
91 | * @param string $method |
||
92 | * @param array $body |
||
|
|||
93 | */ |
||
94 | public function __construct($url, array $params = [], $method = 'GET', $body = null){ |
||
106 | |||
107 | /** |
||
108 | * @param $name |
||
109 | * |
||
110 | * @return mixed |
||
111 | */ |
||
112 | public function __get($name){ |
||
115 | |||
116 | /** |
||
117 | * @return string URL with merged params |
||
118 | */ |
||
119 | public function __toString(){ |
||
122 | |||
123 | /** |
||
124 | * @return string |
||
125 | */ |
||
126 | public function originalParams(){ |
||
129 | |||
130 | /** |
||
131 | * @return string |
||
132 | */ |
||
133 | public function overrideParams(){ |
||
136 | |||
137 | /** |
||
138 | * @return string |
||
139 | */ |
||
140 | public function mergeParams(){ |
||
143 | |||
144 | /** |
||
145 | * @return void |
||
146 | */ |
||
147 | protected function parseUrl(){ |
||
162 | |||
163 | /** |
||
164 | * @return string |
||
165 | */ |
||
166 | protected function getURL(){ |
||
188 | |||
189 | } |
||
190 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive. In addition it looks for parameters that have the generic type
array
and suggests a stricter type likearray<String>
.Most often this is a case of a parameter that can be null in addition to its declared types.