{"id":20253173,"url":"https://github.com/becklyn/rector","last_synced_at":"2025-03-03T16:44:42.513Z","repository":{"id":57678225,"uuid":"490716252","full_name":"Becklyn/rector","owner":"Becklyn","description":"A collection of various refactoring rules for projects that use Rector and mainly Symfony","archived":false,"fork":false,"pushed_at":"2022-05-30T08:31:35.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"1.x","last_synced_at":"2025-02-15T15:49:58.125Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Becklyn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2022-05-10T13:47:07.000Z","updated_at":"2022-05-10T15:01:26.000Z","dependencies_parsed_at":"2022-09-14T03:01:59.506Z","dependency_job_id":null,"html_url":"https://github.com/Becklyn/rector","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Becklyn%2Frector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Becklyn%2Frector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Becklyn%2Frector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Becklyn%2Frector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Becklyn","download_url":"https://codeload.github.com/Becklyn/rector/tar.gz/refs/heads/1.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241704398,"owners_count":20006367,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T10:22:04.351Z","updated_at":"2025-03-03T16:44:42.480Z","avatar_url":"https://github.com/Becklyn.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Becklyn Rector\n==============\n\nThis package contains a list of [Rector](https://github.com/rectorphp/rector) rules that help you up-grading your Symfony-based code base and keeping it deprecation-free.\n\n\nInstallation\n============\n\nEasily get this package via Composer: `composer require --dev becklyn/rector`\n\n\nUsage\n=====\n\nAdd the rules that you want \n\nThis bundle uses a default AJAX protocol, that is used in the `AjaxResponseBuilder` and can be used for your\nproject. The ajax call will always return an error 200, as it shouldn't flood the error tracking (with error 400\nAJAX request).\n\nThe protocol looks like this:\n\n```php\n// rector.php\n\nuse Becklyn\\Rector\\Symfony\\ReplaceControllerThisGetWithThisContainerGet;\nuse Rector\\Config\\RectorConfig;\n\nreturn static function (RectorConfig $rectorConfig): void {\n    // …\n    \n    $rectorConfig-\u003erule(ReplaceControllerThisGetWithThisContainerGet::class);\n    \n    // …\n};\n```\n\n\nAvailable rules\n===============\n\n### `Becklyn\\\\Rector\\\\Symfony\\\\ReplaceControllerThisGetWithThisContainerGet`\n\nControllers that were trying to access dependencies via `$this-\u003eget(…)` will be refactored to use `$this-\u003econtainer-\u003eget(…)`.\n\nBefore:\n\n```php\nclass ExtendingAbstractController extends \\Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController\n{\n    public function run()\n    {\n        $this-\u003eget(SomeClass::class);\n    }\n\n    public function runFaster()\n    {\n        $service = $this-\u003eget(SomeOtherClass::class);\n    }\n\n    public function runEvenFaster()\n    {\n        return $this-\u003eget(BestClass::class);\n    }\n}\n```\n\nAfter:\n\n```php\nclass ExtendingAbstractController extends \\Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController\n{\n    public function run()\n    {\n        $this-\u003econtainer-\u003eget(SomeClass::class);\n    }\n\n    public function runFaster()\n    {\n        $service = $this-\u003econtainer-\u003eget(SomeOtherClass::class);\n    }\n\n    public function runEvenFaster()\n    {\n        return $this-\u003econtainer-\u003eget(BestClass::class);\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbecklyn%2Frector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbecklyn%2Frector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbecklyn%2Frector/lists"}