1 | <?php |
||
22 | abstract class Theme implements ThemeInterface |
||
23 | { |
||
24 | /** |
||
25 | * Constructor. |
||
26 | */ |
||
27 | public function __construct() |
||
35 | |||
36 | /** |
||
37 | * All about ACF configuration should be instantiated here. |
||
38 | */ |
||
39 | protected function acf() |
||
45 | |||
46 | /** |
||
47 | * Filters the selectable templates. |
||
48 | */ |
||
49 | private function templateSelector() |
||
56 | } |
||
57 |
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: