Skip to content

Commit

Permalink
refactor(Log): Use new in initializer instead of constructor body
Browse files Browse the repository at this point in the history
PHP 8.1 allows us to now move the `new` into the initializer,
this makes the code a bit nicer (and 3 lines shorter).

Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Aug 16, 2024
1 parent c8e09d1 commit ce1e8e4
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/private/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,9 @@ class Log implements ILogger, IDataLogger {
public function __construct(
private IWriter $logger,
private SystemConfig $config,
private ?Normalizer $normalizer = null,
private Normalizer $normalizer = new Normalizer(),
private ?IRegistry $crashReporters = null
) {
// FIXME: php8.1 allows "private Normalizer $normalizer = new Normalizer()," in initializer
if ($normalizer === null) {
$this->normalizer = new Normalizer();
}
}

public function setEventDispatcher(IEventDispatcher $eventDispatcher): void {
Expand Down

0 comments on commit ce1e8e4

Please sign in to comment.