Useless Function Calls¶
This pass detects calls to functions or methods whose return value is not used and which have no side-effects.
For example, considering code such as:
class MyClass
{
private $x;
public function getX()
{
return $this->x;
}
}
$myClass = new MyClass();
$myClass->getX(); // Would be flagged as it can simply be removed.
$x = $myClass->getX(); // This is fine as the return value is used.