The expression $view->getType() of type null|string is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.
In PHP, under loose comparison (like ==, or !=, or switch conditions),
values of different types might be equal.
For string values, the empty string '' is a special case, in particular
the following results might be unexpected:
''==false// true''==null// true'ab'==false// false'ab'==null// false// It is often better to use strict comparison''===false// false''===null// false
Loading history...
15
$target->setType($view->getType());
16
}
17
foreach ($view->getParameters() as $parameter => $value) {
18
$target->setParameter($parameter, $value);
19
}
20
foreach ($view->getIgnoredProperties() as $property) {
21
$target->addIgnoredProperty($property);
22
}
23
foreach ($view->getExistingProperties() as $property) {
24
$target->forgetIgnoredProperty($property);
25
}
26
}
27
return $target;
28
}
29
30
public static function from(ViewInterface $view): View
31
{
32
return static::merge($view);
33
}
34
35
public static function toMutable(ViewInterface $view): View
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: