1 | <?php |
||
26 | class FunctionAvailabilityCheck |
||
27 | { |
||
28 | /** |
||
29 | * Cache. |
||
30 | * |
||
31 | * @var string[] |
||
32 | */ |
||
33 | private static $blackListSuhosin; |
||
34 | |||
35 | /** |
||
36 | * Cache. |
||
37 | * |
||
38 | * @var string[] |
||
39 | */ |
||
40 | private static $blackListPhpIni; |
||
41 | |||
42 | |||
43 | /** |
||
44 | * Check if function is defined. |
||
45 | * |
||
46 | * @param string $function The function to test. |
||
47 | * |
||
48 | * @param string|null $extension The optional name of an php extension providing said function. |
||
49 | * |
||
50 | * @return bool |
||
51 | */ |
||
52 | public static function isFunctionEnabled($function, $extension = null) |
||
60 | |||
61 | /** |
||
62 | * Check if function is defined. |
||
63 | * |
||
64 | * @param string $function The function to test. |
||
65 | * |
||
66 | * @return bool |
||
67 | */ |
||
68 | public static function isFunctionDefined($function) |
||
72 | |||
73 | /** |
||
74 | * Check if function is blacklisted in Suhosin. |
||
75 | * |
||
76 | * @param string $function The function to test. |
||
77 | * |
||
78 | * @return bool |
||
79 | */ |
||
80 | public static function isFunctionBlacklistedInSuhosin($function) |
||
92 | |||
93 | /** |
||
94 | * Check if method is blacklisted in Suhosin. |
||
95 | * |
||
96 | * @param string $function The function to test. |
||
97 | * |
||
98 | * @return bool |
||
99 | */ |
||
100 | public static function isFunctionBlacklistedInPhpIni($function) |
||
108 | |||
109 | /** |
||
110 | * Check if a function is mentioned in the passed (comma separated) list. |
||
111 | * |
||
112 | * @param string $function The function to test. |
||
113 | * |
||
114 | * @param string[] $list The function list. |
||
115 | * |
||
116 | * @return bool |
||
117 | */ |
||
118 | public static function isFunctionsMentionedInList($function, $list) |
||
126 | |||
127 | /** |
||
128 | * Explode a list. |
||
129 | * |
||
130 | * @param string $list The list. |
||
131 | * |
||
132 | * @return string[] |
||
133 | */ |
||
134 | private static function prepareList($list) |
||
138 | } |
||
139 |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: