Instant Upgrades and Instant Refactorings for PHP Applications. Why do it manually?
#rectorphp
Created by @votrubaTgetrector.com/hire-team PHP CommunityJoined December 2018
Instead of writing every Symfony/Laravel/... @rectorphp upgrade config manually for every minor version there is,
maybe Rector could look into @deprecated / #[Deprecated] and figure out the change itself, right?
Would this be useful? WDYT? 🤔
Now important than ever:
surface all the hidden mixed types in your code using @phpstan extension,
to avoid bugs like:
class SomeClass
{
public function call(array $ids)
{
}
}
/** @var mixed $someClass */
$someClass->call(1, 2, 3);
Works on any codebase, level 0-8
tomasvotruba.com/blog/not-all-m…
I just want to say Abdul is very much a silent but huge part of the PHP community. He's been invaluable for managing Laravel Rector and @rectorphp itself.
If you love those tools he's a great person to sponsor.
260+ @phpstan rules live scattered across a dozen Github repos with patchy docs. Nobody finds them.
So I built one searchable page: plain-language descriptions + code examples for every rule. Find the one you need → automate it in CI 👇
tomasvotruba.com/blog/find-the-…
#phsptan pro tip for code that is not perfect yet (legacy, huge, growing, not on level 6, with 100+ ignores...)
If you want to get the most out of PHPStan, without going through 1000+ of reported errors of different types, start with one rule at a time.
"But how to do that? These levels so huge!"
1. disable the levels using "customRulesetUsed" magic word
2. start with effective rules like CallMethodsRule
This yields ~11 errors of one type our codebase (against 150+ on level 0)
I can fix it now. It brings instant value without stress.
It's easy to review, even if you're busy and your codebase has no tests.
Do you have more time? Add next rule the same way.
How to figure out how particular rule is called?
Just ask your favorite GPT :)
These are top 6 features of @symfony 8.1 I'd love to use 😍
🧵
Are you stuck on Symfony 1, 2 or 3...?
Let me know. We'll help you upgrade before next Symfony release 🚀
Inspired by these rules, we've added a brand new prepared set to @rectorphp - namedArgs 🎉🎉🎉
github.com/rectorphp/rect…
Release coming soon...
Any new rules that would deserve its place in the set? Keep them shipping ⬇️
Introducing CTOR: #PHPStan extension package to catch fake optional setters ↓
tomasvotruba.com/blog/introduci…
Useful for both legacy and modern codebases to improve latent object design.
Laravel Rector 2.4.0 just dropped 💪
We've got new contributors joining the project, which is always great to see.
Shoutout to @MrPunyapal for pushing the Attributes work forward. I'll have to cover this work in full another day, but it's very impressive.
AI often won't be aware of these changes, so if you want to apply them to your codebases, @rectorphp is by far the easiest way to do it consistently and correctly.
Again got chance to contribute to Laravel Rector package 📦
And now you can refactor almost all old ways to new attributes way in Laravel automatically 🙌💪
Laravel Rector 2.4.0 just dropped 💪
We've got new contributors joining the project, which is always great to see.
Shoutout to @MrPunyapal for pushing the Attributes work forward. I'll have to cover this work in full another day, but it's very impressive.
AI often won't be
Björn Brala @bbrala outlined how Drupal Rector uses structured transformation mappings to automate deprecated API rewrites, static analysis remediation, and scalable upgrade workflows across Drupal codebases.
bit.ly/4nJivIo#Drupal#Rector#PHP#Automation
PHP introduced `??` and `??=` years ago…
but I still see many developers stuck with ternary operators for default values 😅
Have you fully switched to null coalescing operators
or still using ternary out of habit? 👀
Marketing and GPTs show the happy path. Not the best path.
This was one of the toughest upgrades. Not because it was complicated, but we faced it first time. It was easy to choose a bad path.
@doctrineproject Alice Fixtures upgrade. Last part:
tomasvotruba.com/blog/alice-nel…
I love levels from @rectorphp, but missed them in ECS.
Applying coding standard on a huge codebase is no fun.
Especially when there are ~100 + existing PRs opened (rebase hell).
Today, I've added levels to ECS as well 🥳 to remove thinking about "which is the rule?" for good
Just had a wrap up call with one of our clients. They surprised us with very nice stats😇
* 2230 merged PRs in 20 months
* thats 111.5 merged PRs a month
* type coverage from 35 % to 96 %
* 10 forked repositories to 0
Not bad for a part-time job 🥳🥳🥳
من الأدوات الي ما استغني عنها بكل مشروع أشتغله هي "php rector"، أداة مفتوحة المصدر يوم تشغلها على codebase مشروعك تسوي refactoring وتحسينات للكود، ويمدي تضبط الـrules من خلال ملف الـconfig، ولـLaravel بتحتاج تثبت ذا الـplugin معها:
getrector.comgithub.com/driftingly/rec…
Good NEWS Good NEWS Good NEWS 📢📢
PHP devs, who use Rector and Pest, the rector-pest has got a lot better at chaining now. No long one-line chains now. It now refactors your chains into logical new lines 💪💪
Update to rector-pest 0.2.7 🫡
It also adds new goodies rules 😉
6K Followers 30 Following✍️ Writing a book about final solution to legacy https://t.co/ffWET1OvFW
😎 Upgrading PHP legacy projects
🤖 Automating PHP code with @rectorphp
4K Followers 1K FollowingSenior PHP Engineer via @ExploreAdeva | Building @codysseydev | Sharing Software Architecture and Design tips and tricks with PHP
1K Followers 369 Following🇵🇱 https://t.co/HerX32NWvo 🇬🇧 https://t.co/m6h4mNhOBh | Self-educated specialist: PHP, CI/CD, QA automation, Docker, Gitlab and more 😎. Member of @PHPCSFixer team 🪶.
95 Followers 5K FollowingMe gustan, la tecnología, los gadgets, el diseño inteligente. Amo: el basquetbol; cocinar; internarme un día entero en el cine; mi familia
260 Followers 2K FollowingHi, I'm a software developer with a passion for solving problems and building innovative solutions. I specialize in Backend Dev, looking for new challenges #web
1 Followers 61 FollowingPHP & high-performance systems lab. Exploring architectural limits by deconstructing and rebuilding web software from the ground up to scale under massive loads
6K Followers 30 Following✍️ Writing a book about final solution to legacy https://t.co/ffWET1OvFW
😎 Upgrading PHP legacy projects
🤖 Automating PHP code with @rectorphp