Skip to content

Commit 2444103

Browse files
committed
Give the correct deprecations for PHP 8.1+
This isn't just for integers that are outside the integer range of -128, 255. https://3v4l.org/PgZ6c
1 parent 80b0d3f commit 2444103

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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)