Skip to content

Conversation

arshidkv12
Copy link
Contributor


$argExpr = $args[0]->value;

$value = $this->valueResolver->getValue($argExpr);
Copy link
Member

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.

@samsonasik
Copy link
Member

when switch between branch on multiple PRs, please start over checkout from main instead of last branch so commits are not mixed up:

# eg: you're on foo branch from PR #123 
# you want to create new PR, then go back to main branch first
git checkout main

# register repo if not yet
git remote add upstream [email protected]:rectorphp/rector-src.git


# pull latest upstream main
git pull upstream main

# swith for new PR
git checkout new-bar

@arshidkv12
Copy link
Contributor Author

Thank you

@arshidkv12
Copy link
Contributor Author

 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

@samsonasik
Copy link
Member

You may need to use https:

git remote set-url upstream https://github.com/rectorphp/rector-src.git

@@ -0,0 +1,9 @@
<?php
namespace Rector\Tests\Php85\Rector\FuncCall\OrdSingleByteRector\Fixture;
echo ord(123);
Copy link
Member

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');
Copy link
Member

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);

Comment on lines 80 to 82
$isInt = is_int($value);
$value = (string) $value;
$byte = $value[0] ?? '';
Copy link
Member

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;
}

@arshidkv12 arshidkv12 force-pushed the php8.5_ord branch 3 times, most recently from 46ebae7 to 9da7aa0 Compare September 5, 2025 01:04
@arshidkv12 arshidkv12 closed this Sep 5, 2025
@arshidkv12 arshidkv12 deleted the php8.5_ord branch September 5, 2025 01:08
@arshidkv12 arshidkv12 restored the php8.5_ord branch September 5, 2025 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants