You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public function foo(Collection $collection)
{
$collection->add($this->bar);
$collection->add($this->bar);
if ($collection instanceof BOOM) {
$collection->add($this->some)
}
}
which reports an error because I didn't use an early exit.
But changing
if ($collection instanceof BOOM) {
$collection->add($this->some)
}
to
if (! $collection instanceof BOOM) {
return;
}
$collection->add($this->some)
is taking more lines and not really reducing complexity.
Also, I may change later to
public function foo(Collection $collection)
{
$collection->add($this->bar);
$collection->add($this->bar);
if ($collection instanceof Boom) {
$collection->add($this->some)
}
if ($collection instanceof Please) {
$collection->add($this->thanks)
}
}
I have the following method
which reports an error because I didn't use an early exit.
But changing
to
is taking more lines and not really reducing complexity.
Also, I may change later to
and so on.
The slevomat Early Exit standard has some configuration available
https://github.com/slevomat/coding-standard#slevomatcodingstandardcontrolstructuresearlyexit-
I would say it's better to use some.
The text was updated successfully, but these errors were encountered: