-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
[PHP8.3] add new rectors for get_class()/get_parent_class() without arguments #6405
Conversation
You need to rebase latest main branch to fix unit test: git checkout main
git pull [email protected]:rectorphp/rector-src.git main
git checkout add-get-class-rectors
git rebase main
git push --force origin add-get-class-rectors |
ugh, I just realized I keep |
…ass() without arguments
2a2e573
to
6ad00a7
Compare
even with the correct main pulled (d246d27), still a failure in an unrelated test, both on main and on my rebased branch:
|
composer update :) |
TA-DA! all clean on both main and my branch now. Thanks for that tip! I guess I'm spoiled by having all of our repos at work automatically do that whenever git detects a change to the composer.* files. :) |
rules/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector.php
Outdated
Show resolved
Hide resolved
converting to draft while I re-work the rules... may take a few days given my other workload. |
57573db
to
79a25e6
Compare
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.
LGTM
Thank you 🥳 |
This adds two new rules to the PHP8.3 collection for replacing the newly deprecated calls to
get_class()
andget_parent_class()
without passing an object argument to them.I choose to use
__CLASS__
as the replacement forget_class()
as it has wider support, going back to 5.0, than the alternative ofself::class
, which only goes back to 5.4.I choose to use
parent::class
as the replacement forget_parent_class()
as it felt like the most direct logical mapping.These are also my first rectors, I welcome feedback on them. (I have since writing these a couple months back written a few more significantly more complex ones that are unique to our codebase, these were my first foray to learn how they work.)