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.
Loading history...
13
if (is_object($from)) {
14
$fromVars = get_object_vars($from);
15
} else if (is_array($from)) {
16
$fromVars = $from;
17
}
18
if ($fromVars === null) throw new \InvalidArgumentException('Source must be an object or array');
19
if (!is_object($to)) throw new \InvalidArgumentException('Destination must be an object');
20
$toVars = get_object_vars($to);
21
foreach ($fromVars as $prop=>$value) {
22
if (array_key_exists($prop, $toVars)) {
23
$to->$prop = $value;
24
} else {
25
$methodName = 'set'.ucfirst($prop);
26
if (method_exists($to, $methodName)) {
27
$to->{$methodName}($value);
28
}
29
}
30
if ($stripPrefix && strpos($prop, $stripPrefix) === 0) {
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.