From 4446fa83e3d0f44ec1ebd6c6ca9d90be8ea6c355 Mon Sep 17 00:00:00 2001 From: sebastianstucke87 <47354551+sebastianstucke87@users.noreply.github.com> Date: Fri, 21 Jul 2023 13:28:19 +0200 Subject: [PATCH] Update README.md Updated code style: - strict_types - final readonly class - promoted properties - NullLogger instead of dealing with null (thereby removing the null-pointer exception I added in 2019...) - handle \Throwable - short-array syntax --- README.md | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a9f20c4..c23970f 100644 --- a/README.md +++ b/README.md @@ -22,27 +22,25 @@ If you need a logger, you can use the interface like this: ```php logger = $logger; - } + $this->logger->info('Doing work'); - public function doSomething() - { - if ($this->logger) { - $this->logger->info('Doing work'); - } - try { $this->doSomethingElse(); - } catch (Exception $exception) { - $this->logger->error('Oh no!', array('exception' => $exception)); + } catch (Throwable $e) { + $this->logger->error('Oh no!', ['exception' => $e]); } // do something useful