The call to the method Benrowe\Laravel\Widgets\AbstractWidget::init() seems un-needed as the method has no side-effects.
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.
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:
$user=newUser();$user->getEmail();// This line could safely be removed as it has no effect.
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:
$user=newUser();$user->setEmail('email@domain');// This line has a side-effect (it changes an// instance variable).
Loading history...
24
}
25
26
/**
27
* Custom initilisation for the widget
28
*
29
* @return boolean
30
*/
31
protected function init()
32
{
33
return true;
34
}
35
36
/**
37
* Retrieve the configuration value from the widget, based
This check compares the return type specified in the @return annotation of a function
or method doc comment with the types returned by the function and raises an issue if they
mismatch.
Loading history...
61
*/
62
public function addCfg($key, $value)
63
{
64
if ($this->isConfigProperty($key)) {
65
$this->$key = $value;
66
return;
67
}
68
69
}
70
71
/**
72
* Determine if the public property exists, and is public
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: