1818 */
1919class Logger implements ILogger
2020{
21- /** @var string|null name of the directory where errors should be logged */
22- public $ directory ;
21+ /** name of the directory where errors should be logged */
22+ public ? string $ directory = null ;
2323
24- /** @var string|array|null email or emails to which send error notifications */
25- public $ email ;
24+ /** email or emails to which send error notifications */
25+ public string | array | null $ email = null ;
2626
27- /** @var string|null sender of email notifications */
28- public $ fromEmail ;
27+ /** sender of email notifications */
28+ public ? string $ fromEmail = null ;
2929
30- /** @var mixed interval for sending email is 2 days */
31- public $ emailSnooze = '2 days ' ;
30+ /** interval for sending email is 2 days */
31+ public mixed $ emailSnooze = '2 days ' ;
3232
3333 /** @var callable(mixed $message, string $email): void handler for sending emails */
3434 public $ mailer ;
3535
36- /** @var BlueScreen|null */
37- private $ blueScreen ;
36+ private ?BlueScreen $ blueScreen = null ;
3837
3938
4039 public function __construct (?string $ directory , string |array |null $ email = null , ?BlueScreen $ blueScreen = null )
@@ -81,10 +80,7 @@ public function log(mixed $message, string $level = self::INFO)
8180 }
8281
8382
84- /**
85- * @param mixed $message
86- */
87- public static function formatMessage ($ message ): string
83+ public static function formatMessage (mixed $ message ): string
8884 {
8985 if ($ message instanceof \Throwable) {
9086 foreach (Helpers::getExceptionChain ($ message ) as $ exception ) {
@@ -104,10 +100,7 @@ public static function formatMessage($message): string
104100 }
105101
106102
107- /**
108- * @param mixed $message
109- */
110- public static function formatLogLine ($ message , ?string $ exceptionFile = null ): string
103+ public static function formatLogLine (mixed $ message , ?string $ exceptionFile = null ): string
111104 {
112105 return implode (' ' , [
113106 date ('[Y-m-d H-i-s] ' ),
@@ -155,10 +148,7 @@ protected function logException(\Throwable $exception, ?string $file = null): st
155148 }
156149
157150
158- /**
159- * @param mixed $message
160- */
161- protected function sendEmail ($ message ): void
151+ protected function sendEmail (mixed $ message ): void
162152 {
163153 $ snooze = is_numeric ($ this ->emailSnooze )
164154 ? $ this ->emailSnooze
@@ -177,10 +167,9 @@ protected function sendEmail($message): void
177167
178168 /**
179169 * Default mailer.
180- * @param mixed $message
181170 * @internal
182171 */
183- public function defaultMailer ($ message , string $ email ): void
172+ public function defaultMailer (mixed $ message , string $ email ): void
184173 {
185174 $ host = preg_replace ('#[^\w.-]+# ' , '' , $ _SERVER ['SERVER_NAME ' ] ?? php_uname ('n ' ));
186175 mail (
0 commit comments