Skip to content

Commit 97797eb

Browse files
committed
Php Inspections (EA Extended) - static code analysis includes:
Reduce couple count calls in [Yaml] Modernize type casting, fix several strict comparisons Unsets merged Elvis operator usage Short syntax for applied operations
1 parent 3a753c8 commit 97797eb

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

Options.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ public function set($option, $value)
9292

9393
// Setting is equivalent to overloading while discarding the previous
9494
// option value
95-
unset($this->options[$option]);
96-
unset($this->lazy[$option]);
95+
unset($this->options[$option], $this->lazy[$option]);
9796

9897
$this->overload($option, $value);
9998
}
@@ -270,9 +269,7 @@ public function remove($option)
270269
throw new OptionDefinitionException('Options cannot be removed anymore once options have been read.');
271270
}
272271

273-
unset($this->options[$option]);
274-
unset($this->lazy[$option]);
275-
unset($this->normalizers[$option]);
272+
unset($this->options[$option], $this->lazy[$option], $this->normalizers[$option]);
276273
}
277274

278275
/**
@@ -470,10 +467,8 @@ private function resolve($option)
470467
foreach ($this->lazy[$option] as $closure) {
471468
$this->options[$option] = $closure($this, $this->options[$option]);
472469
}
473-
unset($this->lock[$option]);
474-
475470
// The option now isn't lazy anymore
476-
unset($this->lazy[$option]);
471+
unset($this->lock[$option], $this->lazy[$option]);
477472
}
478473

479474
/**
@@ -509,9 +504,7 @@ private function normalize($option)
509504

510505
$this->lock[$option] = true;
511506
$this->options[$option] = $normalizer($this, array_key_exists($option, $this->options) ? $this->options[$option] : null);
512-
unset($this->lock[$option]);
513-
514507
// The option is now normalized
515-
unset($this->normalizers[$option]);
508+
unset($this->lock[$option], $this->normalizers[$option]);
516509
}
517510
}

0 commit comments

Comments
 (0)