@@ -65,31 +65,40 @@ public function __construct(private DatabaseInterface $dbi, private ExpressionLa
6565 'round ' ,
6666 static function (): void {
6767 },
68- static fn (array $ arguments , float $ num ) => round ($ num )
68+ static fn (array $ arguments , float $ num ): float => round ($ num )
6969 );
7070 $ this ->expression ->register (
7171 'substr ' ,
7272 static function (): void {
7373 },
74- static fn (array $ arguments , string $ string , int $ start , int $ length ) => substr ($ string , $ start , $ length )
74+ static fn (
75+ array $ arguments ,
76+ string $ string ,
77+ int $ start ,
78+ int $ length ,
79+ ): string => substr ($ string , $ start , $ length )
7580 );
7681 $ this ->expression ->register (
7782 'preg_match ' ,
7883 static function (): void {
7984 },
80- static fn (array $ arguments , string $ pattern , string $ subject ) => preg_match ($ pattern , $ subject )
85+ static fn (
86+ array $ arguments ,
87+ string $ pattern ,
88+ string $ subject ,
89+ ): int |bool => preg_match ($ pattern , $ subject ),
8190 );
8291 $ this ->expression ->register (
8392 'ADVISOR_bytime ' ,
8493 static function (): void {
8594 },
86- static fn (array $ arguments , float $ num , int $ precision ) => self ::byTime ($ num , $ precision )
95+ static fn (array $ arguments , float $ num , int $ precision ): string => self ::byTime ($ num , $ precision )
8796 );
8897 $ this ->expression ->register (
8998 'ADVISOR_timespanFormat ' ,
9099 static function (): void {
91100 },
92- static fn (array $ arguments , string $ seconds ) => Util::timespanFormat ((int ) $ seconds )
101+ static fn (array $ arguments , string $ seconds ): string => Util::timespanFormat ((int ) $ seconds )
93102 );
94103 $ this ->expression ->register (
95104 'ADVISOR_formatByteDown ' ,
@@ -100,13 +109,13 @@ static function (): void {
100109 int $ value ,
101110 int $ limes = 6 ,
102111 int $ comma = 0 ,
103- ) => implode (' ' , Util::formatByteDown ($ value , $ limes , $ comma ))
112+ ): string => implode (' ' , Util::formatByteDown ($ value , $ limes , $ comma ))
104113 );
105114 $ this ->expression ->register (
106115 'fired ' ,
107116 static function (): void {
108117 },
109- function (array $ arguments , int |string $ value ) {
118+ function (array $ arguments , int |string $ value ): string {
110119 // Did matching rule fire?
111120 foreach ($ this ->firedRules as $ rule ) {
112121 if ($ rule ['id ' ] == $ value ) {
@@ -303,19 +312,19 @@ public function addRule(string $type, array $rule): void
303312 // linking to /server/variables
304313 $ rule ['recommendation ' ] = preg_replace_callback (
305314 '/\{([a-z_0-9]+)\}/Ui ' ,
306- fn (array $ matches ) => $ this ->replaceVariable ($ matches ),
315+ fn (array $ matches ): string => $ this ->replaceVariable ($ matches ),
307316 $ rule ['recommendation ' ],
308317 );
309318 $ rule ['issue ' ] = preg_replace_callback (
310319 '/\{([a-z_0-9]+)\}/Ui ' ,
311- fn (array $ matches ) => $ this ->replaceVariable ($ matches ),
320+ fn (array $ matches ): string => $ this ->replaceVariable ($ matches ),
312321 $ rule ['issue ' ],
313322 );
314323
315324 // Replaces external Links with Core::linkURL() generated links
316325 $ rule ['recommendation ' ] = preg_replace_callback (
317326 '#href=("| \')(https?://[^" \']+)\1#i ' ,
318- fn (array $ matches ) => $ this ->replaceLinkURL ($ matches ),
327+ fn (array $ matches ): string => $ this ->replaceLinkURL ($ matches ),
319328 $ rule ['recommendation ' ],
320329 );
321330
0 commit comments