@@ -162,15 +162,9 @@ public function __construct(?string $encoding = null)
162162 $ this ->htmlSpecialCharsFlags = ENT_QUOTES | ENT_SUBSTITUTE ;
163163
164164 // set matcher callbacks
165- $ this ->htmlAttrMatcher =
166- /** @param array<array-key, string> $matches */
167- fn (array $ matches ): string => $ this ->htmlAttrMatcher ($ matches );
168- $ this ->jsMatcher =
169- /** @param array<array-key, string> $matches */
170- fn (array $ matches ): string => $ this ->jsMatcher ($ matches );
171- $ this ->cssMatcher =
172- /** @param array<array-key, string> $matches */
173- fn (array $ matches ): string => $ this ->cssMatcher ($ matches );
165+ $ this ->htmlAttrMatcher = $ this ->htmlAttrMatcher (...);
166+ $ this ->jsMatcher = $ this ->jsMatcher (...);
167+ $ this ->cssMatcher = $ this ->cssMatcher (...);
174168 }
175169
176170 /**
@@ -197,7 +191,7 @@ public function escapeHtmlAttr(string $string)
197191 return $ string ;
198192 }
199193
200- $ result = preg_replace_callback ('/[^a-z0-9,\.\-_]/iSu ' , $ this ->htmlAttrMatcher , $ string );
194+ $ result = preg_replace_callback ('/[^a-z0-9,\.\-_]/iu ' , $ this ->htmlAttrMatcher , $ string );
201195 assert (is_string ($ result ));
202196
203197 return $ this ->fromUtf8 ($ result );
@@ -211,7 +205,7 @@ public function escapeJs(string $string)
211205 return $ string ;
212206 }
213207
214- $ result = preg_replace_callback ('/[^a-z0-9,\._]/iSu ' , $ this ->jsMatcher , $ string );
208+ $ result = preg_replace_callback ('/[^a-z0-9,\._]/iu ' , $ this ->jsMatcher , $ string );
215209 assert (is_string ($ result ));
216210
217211 return $ this ->fromUtf8 ($ result );
@@ -231,7 +225,7 @@ public function escapeCss(string $string)
231225 return $ string ;
232226 }
233227
234- $ result = preg_replace_callback ('/[^a-z0-9]/iSu ' , $ this ->cssMatcher , $ string );
228+ $ result = preg_replace_callback ('/[^a-z0-9]/iu ' , $ this ->cssMatcher , $ string );
235229 assert (is_string ($ result ));
236230
237231 return $ this ->fromUtf8 ($ result );
0 commit comments