-
-
Notifications
You must be signed in to change notification settings - Fork 410
[PHP 8.5] Introduce PhpVersion::DEPRECATE_ORD_WITH_MULTIBYTE_STRING #7191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
$argExpr = $args[0]->value; | ||
|
||
$value = $this->valueResolver->getValue($argExpr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs check if $value
is null
which may can be fetch from variable:
function foo($x)
{
echo ord($x);
}
which we don't know the context, so should be skipped.
when switch between branch on multiple PRs, please start over checkout from main instead of last branch so commits are not mixed up:
|
Thank you |
git pull upstream main 3 ✘
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights |
You may need to use
|
6f2496c
to
e57a273
Compare
@@ -0,0 +1,9 @@ | |||
<?php | |||
namespace Rector\Tests\Php85\Rector\FuncCall\OrdSingleByteRector\Fixture; | |||
echo ord(123); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add test for:
$var = 123;
echo ord($var);
@@ -0,0 +1,9 @@ | |||
<?php | |||
namespace Rector\Tests\Php85\Rector\FuncCall\OrdSingleByteRector\Fixture; | |||
echo ord('abc'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add test for:
$var = 'abc';
echo ord($var);
$isInt = is_int($value); | ||
$value = (string) $value; | ||
$byte = $value[0] ?? ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably verify its $argExpr
type itself:
$type = $this->nodeTypeResolver->getNativeType($argExpr);
if (! $type->isInteger()->yes() && ! $type->isString()->yes()) {
return null;
}
46ebae7
to
9da7aa0
Compare
9da7aa0
to
d04dcf7
Compare
https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_string_which_are_not_one_byte_long_to_ord