@@ -235,7 +235,7 @@ public function match(string $regexp, int $flags = 0, int $offset = 0): array
235235 $ lastError = preg_last_error ();
236236
237237 foreach (get_defined_constants (true )['pcre ' ] as $ k => $ v ) {
238- if ($ lastError === $ v && ' _ERROR ' === substr ($ k , - 6 )) {
238+ if ($ lastError === $ v && str_ends_with ($ k , ' _ERROR ' )) {
239239 throw new RuntimeException ('Matching failed with ' .$ k .'. ' );
240240 }
241241 }
@@ -327,7 +327,7 @@ public function replaceMatches(string $fromRegexp, string|callable $to): static
327327 $ lastError = preg_last_error ();
328328
329329 foreach (get_defined_constants (true )['pcre ' ] as $ k => $ v ) {
330- if ($ lastError === $ v && ' _ERROR ' === substr ($ k , - 6 )) {
330+ if ($ lastError === $ v && str_ends_with ($ k , ' _ERROR ' )) {
331331 throw new RuntimeException ('Matching failed with ' .$ k .'. ' );
332332 }
333333 }
@@ -465,7 +465,7 @@ public function width(bool $ignoreAnsiDecoration = true): int
465465 $ width = 0 ;
466466 $ s = str_replace (["\x00" , "\x05" , "\x07" ], '' , $ this ->string );
467467
468- if (false !== strpos ($ s , "\r" )) {
468+ if (str_contains ($ s , "\r" )) {
469469 $ s = str_replace (["\r\n" , "\r" ], "\n" , $ s );
470470 }
471471
0 commit comments