1 | <?php |
||
12 | class EnumBench |
||
13 | { |
||
14 | private static $constants; |
||
15 | private static $names; |
||
16 | private static $values; |
||
17 | private static $ordinals; |
||
18 | private static $enumerators; |
||
19 | |||
20 | public static function initClass() |
||
30 | |||
31 | public function benchGetName() |
||
37 | |||
38 | public function benchGetValue() |
||
44 | |||
45 | public function benchGetOrdinal() |
||
51 | |||
52 | public function benchIsByEnumerator() |
||
58 | |||
59 | public function benchIsByValue() |
||
65 | |||
66 | public function benchGetConstants() |
||
70 | |||
71 | public function benchGetValues() |
||
75 | |||
76 | public function benchGetNames() |
||
80 | |||
81 | public function benchGetOrdinals() |
||
85 | |||
86 | public function benchGetEnumerators() |
||
90 | |||
91 | public function benchByValue() |
||
97 | |||
98 | public function benchByName() |
||
104 | |||
105 | public function benchByOrdinal() |
||
111 | |||
112 | public function benchGetByValues() |
||
118 | |||
119 | public function benchGetByEnumerator() |
||
125 | |||
126 | public function benchGetByCallStatic() |
||
132 | |||
133 | public function benchHasByEnumerator() |
||
139 | |||
140 | public function benchHasByValue() |
||
146 | } |
||
147 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()
method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail()
, this method _has_ side-effects. In the following case, we could not remove the method call: