for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Kaloa\Renderer\Inigo\Handler;
use Kaloa\Renderer\Inigo\Handler\ProtoHandler;
/**
*
*/
final class SimpleHandler extends ProtoHandler
{
* @var string
private $front;
private $back;
* @param string $name
* @param int $type
* @param string $front
* @param string $back
public function __construct($name, $type, $front, $back)
$this->name = $name;
$this->type = $type;
$this->front = $front;
$this->back = $back;
}
* @param array $data
* @return string
public function draw(array $data)
$ret = '';
$ret
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
$myVar = 'Value'; $higher = false; if (rand(1, 6) > 3) { $higher = true; } else { $higher = false; }
Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.
$myVar
$higher
if ($data['front']) {
$ret = $this->front;
} else {
$ret = $this->back;
return $ret;
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.