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 7.0] Add DowngradeDirnameLevelsRector #1209

Merged
merged 3 commits into from Nov 11, 2021
Merged

[Downgrade PHP 7.0] Add DowngradeDirnameLevelsRector #1209

merged 3 commits into from Nov 11, 2021

Conversation

villfa
Copy link
Contributor

@villfa villfa commented Nov 10, 2021

No description provided.

{
return new FuncCall(new Name(self::DIRNAME), [$pathArg]);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use pre-upgrade code for readability. So even downgraded code can be read by humans.
The syntax for these is dirname(dirname(...)).

Could you update it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made the change.
There are still cases that I don't handle, like:

$levels = 2;
dirname($path, $levels);

Since Rector relies on PHPStan, it's should be possible to do better but I don't know how.
Do you know if there are others rectors doing something like that? I could use them as examples.

villfa and others added 2 commits November 11, 2021 07:45
Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com>
@TomasVotruba
Copy link
Member

Thank you, I see the is difference between static and dynamic second argument.

@TomasVotruba TomasVotruba merged commit 6a8d823 into rectorphp:main Nov 11, 2021
@villfa villfa deleted the feat/downgrade-dirname-levels branch November 11, 2021 09:44
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