Skip to content
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

[Downgrade PHP 5.5] Add DowngradeArbitraryExpressionArgsToEmptyAndIssetRector #1250

Merged
merged 2 commits into from
Nov 16, 2021
Merged

[Downgrade PHP 5.5] Add DowngradeArbitraryExpressionArgsToEmptyAndIssetRector #1250

merged 2 commits into from
Nov 16, 2021

Conversation

villfa
Copy link
Contributor

@villfa villfa commented Nov 16, 2021

No description provided.

@samsonasik
Copy link
Member

samsonasik commented Nov 16, 2021

how about ArrayDimFetch? could you add example fixture for this:

empty(some_function()['test'])

https://3v4l.org/M44H1

@villfa
Copy link
Contributor Author

villfa commented Nov 16, 2021

Thank you @samsonasik!
This case is correctly supported now.

@samsonasik samsonasik merged commit 5e39ff5 into rectorphp:main Nov 16, 2021
@samsonasik
Copy link
Member

Thank you @villfa

@villfa villfa deleted the feat/downgrade-isset-empty branch November 16, 2021 15:42
@samsonasik
Copy link
Member

@villfa could you create another use case for PropertyFetch/StaticPropertyFetch ?

class A
{
    
}

$a = new A();
isset($a->test);
$a->test !== null;

https://3v4l.org/DD4hG

If the use cases are mostly on function call, method call, and static call, I think you can use flipped check:

if ($this->callAnalyzer->isObjectCall($expr) ||  $this->callAnalyzer->isNewInstance($expr) || $expr instanceof FuncCall)

wdyt?

@villfa
Copy link
Contributor Author

villfa commented Nov 16, 2021

I think you're right. I'll prepare a new PR to fix the missing cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants