Fix non-canonical casts

They may be deprecated, but they should still produce the correct
type...
This commit is contained in:
Nikita Popov 2025-08-09 20:59:30 +02:00
parent dc0962c243
commit bc475ada13
4 changed files with 6 additions and 6 deletions

View file

@ -8,4 +8,4 @@ var_dump((binary) 42);
?> ?>
--EXPECTF-- --EXPECTF--
Deprecated: Non-canonical cast (binary) is deprecated, use the (string) cast instead in %s on line %d Deprecated: Non-canonical cast (binary) is deprecated, use the (string) cast instead in %s on line %d
int(42) string(2) "42"

View file

@ -8,4 +8,4 @@ var_dump((boolean) 42);
?> ?>
--EXPECTF-- --EXPECTF--
Deprecated: Non-canonical cast (boolean) is deprecated, use the (bool) cast instead in %s on line %d Deprecated: Non-canonical cast (boolean) is deprecated, use the (bool) cast instead in %s on line %d
int(42) bool(true)

View file

@ -8,4 +8,4 @@ var_dump((double) 42);
?> ?>
--EXPECTF-- --EXPECTF--
Deprecated: Non-canonical cast (double) is deprecated, use the (float) cast instead in %s on line %d Deprecated: Non-canonical cast (double) is deprecated, use the (float) cast instead in %s on line %d
int(42) float(42)

View file

@ -1648,7 +1648,7 @@ OPTIONAL_WHITESPACE_OR_COMMENTS ({WHITESPACE}|{MULTI_LINE_COMMENT}|{SINGLE_LINE_
if (PARSER_MODE()) { if (PARSER_MODE()) {
zend_error(E_DEPRECATED, "Non-canonical cast (double) is deprecated, use the (float) cast instead"); zend_error(E_DEPRECATED, "Non-canonical cast (double) is deprecated, use the (float) cast instead");
} }
RETURN_TOKEN(T_INT_CAST); RETURN_TOKEN(T_DOUBLE_CAST);
} }
<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"real"{TABS_AND_SPACES}")" { <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"real"{TABS_AND_SPACES}")" {
@ -1667,7 +1667,7 @@ OPTIONAL_WHITESPACE_OR_COMMENTS ({WHITESPACE}|{MULTI_LINE_COMMENT}|{SINGLE_LINE_
if (PARSER_MODE()) { if (PARSER_MODE()) {
zend_error(E_DEPRECATED, "Non-canonical cast (binary) is deprecated, use the (string) cast instead"); zend_error(E_DEPRECATED, "Non-canonical cast (binary) is deprecated, use the (string) cast instead");
} }
RETURN_TOKEN(T_INT_CAST); RETURN_TOKEN(T_STRING_CAST);
} }
<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"array"{TABS_AND_SPACES}")" { <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"array"{TABS_AND_SPACES}")" {
@ -1686,7 +1686,7 @@ OPTIONAL_WHITESPACE_OR_COMMENTS ({WHITESPACE}|{MULTI_LINE_COMMENT}|{SINGLE_LINE_
if (PARSER_MODE()) { if (PARSER_MODE()) {
zend_error(E_DEPRECATED, "Non-canonical cast (boolean) is deprecated, use the (bool) cast instead"); zend_error(E_DEPRECATED, "Non-canonical cast (boolean) is deprecated, use the (bool) cast instead");
} }
RETURN_TOKEN(T_INT_CAST); RETURN_TOKEN(T_BOOL_CAST);
} }
<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("unset"){TABS_AND_SPACES}")" { <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("unset"){TABS_AND_SPACES}")" {