1 | <?php |
||
5 | class Url |
||
6 | { |
||
7 | /** @var array */ |
||
8 | private static $parts; |
||
9 | |||
10 | /** |
||
11 | * Obtener una parte de la URL. |
||
12 | * |
||
13 | * @param $part string Parte de la URL (Ej: host). |
||
14 | * |
||
15 | * @return string|null |
||
16 | */ |
||
17 | 1 | public static function part($part) |
|
21 | |||
22 | /** |
||
23 | * Url tiene una parte. |
||
24 | * |
||
25 | * @return bool true|false |
||
26 | */ |
||
27 | public static function has($part) |
||
31 | |||
32 | /** |
||
33 | * Agregar host a url. |
||
34 | * |
||
35 | * @param $url string Url |
||
36 | * @param $host string Dominio |
||
37 | * |
||
38 | * @return string |
||
39 | */ |
||
40 | 1 | public static function addHost($url, $host) |
|
44 | |||
45 | /** |
||
46 | * Agregar http a url. |
||
47 | * |
||
48 | * @param $url string Url |
||
49 | * @param $scheme string Esquema |
||
50 | * |
||
51 | * @return string $url |
||
52 | */ |
||
53 | 1 | public static function addScheme($url, $scheme = 'http://') |
|
57 | |||
58 | /** |
||
59 | * Decode unreserved characters |
||
60 | * |
||
61 | * @param $url string Url. |
||
62 | * |
||
63 | * @return string |
||
64 | */ |
||
65 | 1 | public static function decodeUnreserved($url) |
|
69 | |||
70 | /** |
||
71 | * Normalizar URL. |
||
72 | * |
||
73 | * @param $url string Url a normalizar. |
||
74 | * @param $schemeAndHost string Esquema y dominio base (Ej. http://example.com) |
||
75 | * |
||
76 | * @return string |
||
77 | */ |
||
78 | 1 | public static function normalize($url, $host = null) |
|
98 | } |
||
99 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.