Make logger in `ErrorHandler` optional
Why?
ErrorHandler can work without logger.
There're no reasons to make it optional
There're no reasons to make it optional
Optional always is better than a mandatory one. Creating of object is simplier.
NullLogger is there for this purpose
NullLogger is there for this purpose
Yes, optional: private readonly LoggerInterface $logger = new NullLogger()
NullLogger is there for this purpose
There are no reasons to force user to provide logger in case logging in not required, even a NullLogger. Nullable param is more expected, in general.