15
15
*/
16
16
class Logger implements ILogger
17
17
{
18
- /** @var string|null name of the directory where errors should be logged */
19
- public $ directory ;
18
+ /** name of the directory where errors should be logged */
19
+ public ? string $ directory = null ;
20
20
21
- /** @var string|array|null email or emails to which send error notifications */
22
- public $ email ;
21
+ /** email or emails to which send error notifications */
22
+ public string | array | null $ email = null ;
23
23
24
- /** @var string|null sender of email notifications */
25
- public $ fromEmail ;
24
+ /** sender of email notifications */
25
+ public ? string $ fromEmail = null ;
26
26
27
- /** @var mixed interval for sending email is 2 days */
28
- public $ emailSnooze = '2 days ' ;
27
+ /** interval for sending email is 2 days */
28
+ public mixed $ emailSnooze = '2 days ' ;
29
29
30
30
/** @var callable handler for sending emails */
31
31
public $ mailer ;
32
32
33
- /** @var BlueScreen|null */
34
- private $ blueScreen ;
33
+ private ?BlueScreen $ blueScreen = null ;
35
34
36
35
37
36
public function __construct (?string $ directory , string |array |null $ email = null , ?BlueScreen $ blueScreen = null )
@@ -78,10 +77,7 @@ public function log(mixed $message, string $level = self::INFO)
78
77
}
79
78
80
79
81
- /**
82
- * @param mixed $message
83
- */
84
- public static function formatMessage ($ message ): string
80
+ public static function formatMessage (mixed $ message ): string
85
81
{
86
82
if ($ message instanceof \Throwable) {
87
83
foreach (Helpers::getExceptionChain ($ message ) as $ exception ) {
@@ -101,10 +97,7 @@ public static function formatMessage($message): string
101
97
}
102
98
103
99
104
- /**
105
- * @param mixed $message
106
- */
107
- public static function formatLogLine ($ message , ?string $ exceptionFile = null ): string
100
+ public static function formatLogLine (mixed $ message , ?string $ exceptionFile = null ): string
108
101
{
109
102
return implode (' ' , [
110
103
date ('[Y-m-d H-i-s] ' ),
@@ -152,10 +145,7 @@ protected function logException(\Throwable $exception, ?string $file = null): st
152
145
}
153
146
154
147
155
- /**
156
- * @param mixed $message
157
- */
158
- protected function sendEmail ($ message ): void
148
+ protected function sendEmail (mixed $ message ): void
159
149
{
160
150
$ snooze = is_numeric ($ this ->emailSnooze )
161
151
? $ this ->emailSnooze
@@ -174,10 +164,9 @@ protected function sendEmail($message): void
174
164
175
165
/**
176
166
* Default mailer.
177
- * @param mixed $message
178
167
* @internal
179
168
*/
180
- public function defaultMailer ($ message , string $ email ): void
169
+ public function defaultMailer (mixed $ message , string $ email ): void
181
170
{
182
171
$ host = preg_replace ('#[^\w.-]+# ' , '' , $ _SERVER ['SERVER_NAME ' ] ?? php_uname ('n ' ));
183
172
$ parts = str_replace (
0 commit comments