nemiah / phpFinTS

PHP library to communicate with FinTS/HBCI servers
MIT License
131 stars 40 forks source link

Logger returns invalid instance if not set before #384

Closed lukas-staab closed 2 years ago

lukas-staab commented 2 years ago

There will be the following Error if you try to access the logger $fints->getLogger() but the logger was never set.

Uncaught TypeError: Fhp\FinTs::getLogger(): Return value must be of type Fhp\Options\SanitizingLogger, Psr\Log\NullLogger returned

https://github.com/nemiah/phpFinTS/blob/c1ef5dd303203234759b3761f7e378f5488de70a/lib/Fhp/FinTs.php#L31 https://github.com/nemiah/phpFinTS/blob/c1ef5dd303203234759b3761f7e378f5488de70a/lib/Fhp/FinTs.php#L117 The NullLogger is not a Child class of Fhp\Options\SanitizingLogger only of PSR\Log\AbstractLogger.

I think it would be best to implement a Custom NullLogger which inherits from our SanitizingLogger?