[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8178":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":30,"readmeContent":31,"aiSummary":32,"trendingCount":16,"starSnapshotCount":16,"syncStatus":33,"lastSyncTime":34,"discoverSource":35},8178,"rector","rectorphp\u002Frector","rectorphp","Instant Upgrades and Automated Refactoring of any PHP 5.3+ code","https:\u002F\u002Fgetrector.com",null,"PHP",10336,740,86,1,0,7,39,3,43.61,"MIT License",false,"main",[25,26,27,28,5,29],"ast","automated-upgrades","instant-upgrades","php","upgrade","2026-06-12 02:01:50","# Rector - Instant Upgrades and Automated Refactoring\n\n[![Downloads](https:\u002F\u002Fimg.shields.io\u002Fpackagist\u002Fdt\u002Frector\u002Frector.svg?style=flat-square)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Frector\u002Frector)\n\n\u003Cbr>\n\nRector instantly upgrades and refactors the PHP code of your application.  It can help you in 2 major areas:\n\n### 1. Instant Upgrades\n\nRector now supports upgrades from PHP 5.3 to 8.5 and major open-source projects like [Symfony](https:\u002F\u002Fgithub.com\u002Frectorphp\u002Frector-symfony), [PHPUnit](https:\u002F\u002Fgithub.com\u002Frectorphp\u002Frector-phpunit), and [Doctrine](https:\u002F\u002Fgithub.com\u002Frectorphp\u002Frector-doctrine). Do you want to **be constantly on the latest PHP and Framework without effort**?\n\nUse Rector to handle **instant upgrades** for you.\n\n### 2. Automated Refactoring\n\nDo you have code quality you need, but struggle to keep it with new developers in your team? Do you want to see smart code-reviews even when every senior developers sleeps?\n\nAdd Rector to your CI and let it **continuously refactor your code** and keep the code quality high.\n\nRead our [blogpost](https:\u002F\u002Fgetrector.com\u002Fblog\u002Fnew-setup-ci-command-to-let-rector-work-for-you) to see how to set up automated refactoring.\n\n## Install\n\n```bash\ncomposer require rector\u002Frector --dev\n```\n\n## Running Rector\n\nThere are 2 main ways to use Rector:\n\n- a *single rule*, to have the change under control\n- or group of rules called *sets*\n\nTo use them, create a `rector.php` in your root directory:\n\n```bash\nvendor\u002Fbin\u002Frector\n```\n\nAnd modify it:\n\n```php\nuse Rector\\Config\\RectorConfig;\nuse Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictConstructorRector;\n\nreturn RectorConfig::configure()\n    \u002F\u002F register single rule\n    ->withRules([\n        TypedPropertyFromStrictConstructorRector::class\n    ])\n    \u002F\u002F here we can define, what prepared sets of rules will be applied\n    ->withPreparedSets(\n        deadCode: true,\n        codeQuality: true\n    );\n```\n\nThen dry run Rector:\n\n```bash\nvendor\u002Fbin\u002Frector src --dry-run\n```\n\nRector will show you diff of files that it *would* change. To *make* the changes, drop `--dry-run`:\n\n```bash\nvendor\u002Fbin\u002Frector src\n```\n\n## Documentation\n\n* Find [full documentation here](https:\u002F\u002Fgetrector.com\u002Fdocumentation\u002F).\n* [Explore Rector Rules](https:\u002F\u002Fgetrector.com\u002Ffind-rule)\n\n\u003Cbr>\n\n## Learn Faster with a Book\n\nAre you curious, how Rector works internally, how to create your own rules and test them and why Rector was born?\nRead [Rector - The Power of Automated Refactoring](https:\u002F\u002Fleanpub.com\u002Frector-the-power-of-automated-refactoring) that will take you step by step through the Rector setup and how to create your own rules.\n\n\u003Cbr>\n\n## Empowered by Community :heart:\n\nThe Rector community is powerful thanks to active maintainers who take care of Rector sets for particular projects.\n\nAmong there projects belong:\n\n* [palantirnet\u002Fdrupal-rector](https:\u002F\u002Fgithub.com\u002Fpalantirnet\u002Fdrupal-rector)\n* [craftcms\u002Frector](https:\u002F\u002Fgithub.com\u002Fcraftcms\u002Frector)\n* [FriendsOfShopware\u002Fshopware-rector](https:\u002F\u002Fgithub.com\u002FFriendsOfShopware\u002Fshopware-rector)\n* [sabbelasichon\u002Ftypo3-rector](https:\u002F\u002Fgithub.com\u002Fsabbelasichon\u002Ftypo3-rector)\n* [sulu\u002Fsulu-rector](https:\u002F\u002Fgithub.com\u002Fsulu\u002Fsulu-rector)\n* [efabrica-team\u002Frector-nette](https:\u002F\u002Fgithub.com\u002Fefabrica-team\u002Frector-nette)\n* [Sylius\u002FSyliusRector](https:\u002F\u002Fgithub.com\u002FSylius\u002FSyliusRector)\n* [CoditoNet\u002Frector-money](https:\u002F\u002Fgithub.com\u002FCoditoNet\u002Frector-money)\n* [laminas\u002Flaminas-servicemanager-migration](https:\u002F\u002Fgithub.com\u002Flaminas\u002Flaminas-servicemanager-migration)\n* [cakephp\u002Fupgrade](https:\u002F\u002Fgithub.com\u002Fcakephp\u002Fupgrade)\n* [driftingly\u002Frector-laravel](https:\u002F\u002Fgithub.com\u002Fdriftingly\u002Frector-laravel)\n* [contao\u002Fcontao-rector](https:\u002F\u002Fgithub.com\u002Fcontao\u002Fcontao-rector)\n* [php-static-analysis\u002Frector-rule](https:\u002F\u002Fgithub.com\u002Fphp-static-analysis\u002Frector-rule)\n* [ibexa\u002Frector](https:\u002F\u002Fgithub.com\u002Fibexa\u002Frector)\n* [guanguans\u002Frector-rules](https:\u002F\u002Fgithub.com\u002Fguanguans\u002Frector-rules)\n* [wernerkrauss\u002Fsilverstripe-rector](https:\u002F\u002Fgithub.com\u002Fwernerkrauss\u002Fsilverstripe-rector)\n\n\u003Cbr>\n\n## Hire us to get Job Done :muscle:\n\nRector is a tool that [we develop](https:\u002F\u002Fgetrector.com\u002F) and share for free, so anyone can automate their refactoring. But not everyone has dozens of hours to understand complexity of abstract-syntax-tree in their own time. **That's why we provide commercial support - to save your time**.\n\nWould you like to apply Rector on your code base but don't have time for the struggle with your project? [Hire us](https:\u002F\u002Fgetrector.com\u002Fcontact) to get there faster.\n\n\u003Cbr>\n\n## How to Contribute\n\nSee [the contribution guide](\u002FCONTRIBUTING.md) or go to development repository [rector\u002Frector-src](https:\u002F\u002Fgithub.com\u002Frectorphp\u002Frector-src).\n\n\u003Cbr>\n\n## Debugging\n\nYou can use `--debug` option, that will print nested exceptions output:\n\n```bash\nvendor\u002Fbin\u002Frector src\u002FController --dry-run --debug\n```\n\nOr with Xdebug:\n\n1. Make sure [Xdebug](https:\u002F\u002Fxdebug.org\u002F) is installed and configured\n2. Add `--xdebug` option when running Rector\n\n```bash\nvendor\u002Fbin\u002Frector src\u002FController --dry-run --xdebug\n```\n\nTo assist with simple debugging Rector provides 2 helpers to pretty-print AST-nodes:\n\n```php\nuse PhpParser\\Node\\Scalar\\String_;\n$node = new String_('hello world!');\n\n\u002F\u002F prints node to string, as PHP code displays it\nprint_node($node);\n```\n\n\u003Cbr>\n\n## Known Drawbacks\n\n* Rector uses [nikic\u002Fphp-parser](https:\u002F\u002Fgithub.com\u002Fnikic\u002FPHP-Parser\u002F), built on technology called an *abstract syntax tree* (AST). An AST doesn't know about spaces and when written to a file it produces poorly formatted code in both PHP and docblock annotations.\n\n* Rector in parallel mode will work most of the times for most OS. On Windows, you may encounter issues unresolvable despite of following the [Troubleshooting Parallel](https:\u002F\u002Fgetrector.com\u002Fdocumentation\u002Ftroubleshooting-parallel) guide. In such case, check if you are using Powershell 7 (pwsh). Change your terminal to command prompt (cmd) or bash for Windows.\n\n### How to Apply Coding Standards?\n\n**Your project needs to have a coding standard tool** and a set of formatting rules, so it can make Rector's output code nice and shiny again.\n\nWe're using [ECS](https:\u002F\u002Fgithub.com\u002Fsymplify\u002Feasy-coding-standard) with [this setup](https:\u002F\u002Fgithub.com\u002Frectorphp\u002Frector-src\u002Fblob\u002Fmain\u002Fecs.php).\n\n### May cause unexpected output on File with mixed PHP+HTML content\n\nWhen you apply changes to files with PHP + HTML content, you may need to manually verify the changed file after apply the changes.\n","Rector 是一个用于即时升级和自动化重构 PHP 5.3+ 代码的工具。它能够帮助开发者轻松地将代码从 PHP 5.3 升级到 8.5，并支持 Symfony、PHPUnit 和 Doctrine 等主流框架和库的升级。此外，Rector 还可以在持续集成环境中自动执行代码重构，保持代码质量。通过抽象语法树（AST）解析技术，Rector 能够智能地识别并修改代码中的问题，使得整个过程更加高效且准确。适合于需要频繁更新 PHP 版本或维护大型 PHP 项目的企业和个人开发者使用。",2,"2026-06-11 03:16:38","top_language"]