[PHP8.3] add new rectors for get_class()/get_parent_class() without arguments
This adds two new rules to the PHP8.3 collection for replacing the newly deprecated calls to get_class() and get_parent_class() without passing an object argument to them.
I choose to use __CLASS__ as the replacement for get_class() as it has wider support, going back to 5.0, than the alternative of self::class, which only goes back to 5.4.
I choose to use parent::class as the replacement for get_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.)
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
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 git pulling and it's pulling from my fork on git hub instead of the correct upstream... no wonder things haven't changed all week. 🤦 Will get this rebased shortly.
even with the correct main pulled (d246d27a9442cc08a419e899e07c2c19a680eb80), still a failure in an unrelated test, both on main and on my rebased branch:
1) Rector\Tests\Issues\AutoImport\AutoImportTest::test with data set #1 ('/Volumes/Git/rector-src/tests...hp.inc')
Failed on fixture file "doctrine_deep_annotation.php.inc"
...
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. :)
converting to draft while I re-work the rules... may take a few days given my other workload.
Thank you :partying_face: