Skip to content

Commit 8495cbf

Browse files
bug #504 Ctype: Give the correct deprecations for PHP 8.1+ (BackEndTea)
This PR was merged into the 1.x branch. Discussion ---------- Ctype: Give the correct deprecations for PHP 8.1+ This deprecation isn't just for integers that are outside the integer range of -128, 255. https://3v4l.org/PgZ6c Commits ------- 2444103 Give the correct deprecations for PHP 8.1+
2 parents 260ca66 + 2444103 commit 8495cbf

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/Ctype/Ctype.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ public static function ctype_xdigit($text)
211211
*/
212212
private static function convert_int_to_char_for_ctype($int, $function)
213213
{
214+
if (\PHP_VERSION_ID >= 80100 && !\is_string($int)) {
215+
@trigger_error($function.'(): Argument of type '.get_debug_type($int).' will be interpreted as string in the future', \E_USER_DEPRECATED);
216+
}
217+
214218
if (!\is_int($int)) {
215219
return $int;
216220
}
@@ -219,10 +223,6 @@ private static function convert_int_to_char_for_ctype($int, $function)
219223
return (string) $int;
220224
}
221225

222-
if (\PHP_VERSION_ID >= 80100) {
223-
@trigger_error($function.'(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED);
224-
}
225-
226226
if ($int < 0) {
227227
$int += 256;
228228
}

0 commit comments

Comments
 (0)