{"id":16835302,"url":"https://github.com/pedrotroller/phpcsfixer-custom-fixers","last_synced_at":"2025-04-06T14:12:58.109Z","repository":{"id":3456423,"uuid":"49589300","full_name":"PedroTroller/PhpCSFixer-Custom-Fixers","owner":"PedroTroller","description":"A set of new fixers for PHP-CS-Fixer","archived":false,"fork":false,"pushed_at":"2023-10-23T12:59:35.000Z","size":653,"stargazers_count":76,"open_issues_count":18,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T22:23:44.730Z","etag":null,"topics":["custom-fixers","fixers","hacktoberfest","php-cs-fixer"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PedroTroller.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-13T17:18:15.000Z","updated_at":"2024-06-18T13:50:30.039Z","dependencies_parsed_at":"2024-06-18T13:50:25.715Z","dependency_job_id":"d5f7556a-61c1-47e1-9385-14cc22df1993","html_url":"https://github.com/PedroTroller/PhpCSFixer-Custom-Fixers","commit_stats":{"total_commits":157,"total_committers":9,"mean_commits":"17.444444444444443","dds":"0.19108280254777066","last_synced_commit":"1ae8b58f11afabe8c299c087cee77557aee880fa"},"previous_names":[],"tags_count":74,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PedroTroller%2FPhpCSFixer-Custom-Fixers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PedroTroller%2FPhpCSFixer-Custom-Fixers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PedroTroller%2FPhpCSFixer-Custom-Fixers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PedroTroller%2FPhpCSFixer-Custom-Fixers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PedroTroller","download_url":"https://codeload.github.com/PedroTroller/PhpCSFixer-Custom-Fixers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247492565,"owners_count":20947545,"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":["custom-fixers","fixers","hacktoberfest","php-cs-fixer"],"created_at":"2024-10-13T12:09:38.638Z","updated_at":"2025-04-06T14:12:58.089Z","avatar_url":"https://github.com/PedroTroller.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP-CS-FIXER : Custom fixers\n\n[![CircleCI](https://circleci.com/gh/PedroTroller/PhpCSFixer-Custom-Fixers.svg?style=shield)](https://circleci.com/gh/PedroTroller/PhpCSFixer-Custom-Fixers)\n[![Latest Stable Version](https://poser.pugx.org/pedrotroller/php-cs-custom-fixer/v/stable)](https://packagist.org/packages/pedrotroller/php-cs-custom-fixer)\n[![License](https://poser.pugx.org/pedrotroller/php-cs-custom-fixer/license)](https://packagist.org/packages/pedrotroller/php-cs-custom-fixer)\n[![Dependabot Status](https://api.dependabot.com/badges/status?host=github\u0026repo=PedroTroller/PhpCSFixer-Custom-Fixers)](https://dependabot.com)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/PedroTroller/PhpCSFixer-Custom-Fixers/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/PedroTroller/PhpCSFixer-Custom-Fixers/?branch=master)\n\n# Installation\n\n```bash\ncomposer require pedrotroller/php-cs-custom-fixer --dev\n```\n\n### Configuration\n\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = PhpCsFixer\\Config::create()\n    // ...\n    -\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers())\n    // ...\n;\n\nreturn $config;\n```\n\n# Fixers\n\n## PedroTroller/order_behat_steps\n\nStep definition methods in Behat contexts MUST BE ordered by annotation and method name.\n\n\n### Available options\n\n - `instanceof` (*optional*): Parent class or interface of your behat context classes.\n    - default: `Behat\\Behat\\Context\\Context`\n\n### Configuration examples\n\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    [\n        // ...\n        'PedroTroller/order_behat_steps' =\u003e true,\n        // ...\n    ]\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n**OR** using my [rule list builder](doc/rule-set-factory.md).\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    PedroTroller\\CS\\Fixer\\RuleSetFactory::create()\n        -\u003eenable('PedroTroller/order_behat_steps')\n        -\u003egetRules()\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n\n### Fixes\n\n```diff\n--- Original                                                                     // 80 chars\n+++ New                                                                          //\n@@ @@                                                                            //\n     }                                                                           //\n                                                                                 //\n     /**                                                                         //\n-     * @Then the response should be received                                    //\n+     * @BeforeScenario                                                          //\n      */                                                                         //\n-    public function theResponseShouldBeReceived()                               //\n+    public function reset()                                                     //\n     {                                                                           //\n         // ...                                                                  //\n     }                                                                           //\n                                                                                 //\n     /**                                                                         //\n-     * @When a demo scenario sends a request to :path                           //\n+     * @Given I am on the homepage                                              //\n      */                                                                         //\n-    public function aDemoScenarioSendsARequestTo($path)                         //\n+    public function iAmOnTheHomepage()                                          //\n     {                                                                           //\n         // ...                                                                  //\n     }                                                                           //\n                                                                                 //\n     /**                                                                         //\n-     * @Given I am on the homepage                                              //\n+     * @When a demo scenario sends a request to :path                           //\n      */                                                                         //\n-    public function iAmOnTheHomepage()                                          //\n+    public function aDemoScenarioSendsARequestTo($path)                         //\n     {                                                                           //\n         // ...                                                                  //\n     }                                                                           //\n                                                                                 //\n     /**                                                                         //\n-     * @BeforeScenario                                                          //\n+     * @Then the response should be received                                    //\n      */                                                                         //\n-    public function reset()                                                     //\n+    public function theResponseShouldBeReceived()                               //\n     {                                                                           //\n         // ...                                                                  //\n     }                                                                           //\n }                                                                               //\n                                                                                 //\n```\n### Configuration examples\n\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    [\n        // ...\n        'PedroTroller/order_behat_steps' =\u003e [ 'instanceof' =\u003e [ 'Behat\\Behat\\Context\\Context' ] ],\n        // ...\n    ]\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n**OR** using my [rule list builder](doc/rule-set-factory.md).\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    PedroTroller\\CS\\Fixer\\RuleSetFactory::create()\n        -\u003eenable('PedroTroller/order_behat_steps', [ 'instanceof' =\u003e [ 'Behat\\Behat\\Context\\Context' ] ])\n        -\u003egetRules()\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n\n### Fixes\n\n```diff\n--- Original                                                                     // 80 chars\n+++ New                                                                          //\n@@ @@                                                                            //\n     }                                                                           //\n                                                                                 //\n     /**                                                                         //\n-     * @Then the response should be received                                    //\n+     * @BeforeScenario                                                          //\n      */                                                                         //\n-    public function theResponseShouldBeReceived()                               //\n+    public function reset()                                                     //\n     {                                                                           //\n         // ...                                                                  //\n     }                                                                           //\n                                                                                 //\n     /**                                                                         //\n-     * @When a demo scenario sends a request to :path                           //\n+     * @Given I am on the homepage                                              //\n      */                                                                         //\n-    public function aDemoScenarioSendsARequestTo($path)                         //\n+    public function iAmOnTheHomepage()                                          //\n     {                                                                           //\n         // ...                                                                  //\n     }                                                                           //\n                                                                                 //\n     /**                                                                         //\n-     * @Given I am on the homepage                                              //\n+     * @When a demo scenario sends a request to :path                           //\n      */                                                                         //\n-    public function iAmOnTheHomepage()                                          //\n+    public function aDemoScenarioSendsARequestTo($path)                         //\n     {                                                                           //\n         // ...                                                                  //\n     }                                                                           //\n                                                                                 //\n     /**                                                                         //\n-     * @BeforeScenario                                                          //\n+     * @Then the response should be received                                    //\n      */                                                                         //\n-    public function reset()                                                     //\n+    public function theResponseShouldBeReceived()                               //\n     {                                                                           //\n         // ...                                                                  //\n     }                                                                           //\n }                                                                               //\n                                                                                 //\n```\n\n## PedroTroller/ordered_with_getter_and_setter_first\n\nClass/interface/trait methods MUST BE ordered (accessors at the beginning of the class, ordered following properties order).\n\n### Configuration examples\n\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    [\n        // ...\n        'PedroTroller/ordered_with_getter_and_setter_first' =\u003e true,\n        // ...\n    ]\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n**OR** using my [rule list builder](doc/rule-set-factory.md).\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    PedroTroller\\CS\\Fixer\\RuleSetFactory::create()\n        -\u003eenable('PedroTroller/ordered_with_getter_and_setter_first')\n        -\u003egetRules()\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n\n### Fixes\n\n```diff\n--- Original                                                                     // 80 chars\n+++ New                                                                          //\n@@ @@                                                                            //\n         }                                                                       //\n     }                                                                           //\n                                                                                 //\n-    public function setFirstName($firstName)                                    //\n+    public function getIdentifier()                                             //\n     {                                                                           //\n-        $this-\u003efirstName = $firstName;                                          //\n+        return $this-\u003eidentifier;                                               //\n     }                                                                           //\n                                                                                 //\n-    public function setName($name)                                              //\n+    public function getName()                                                   //\n     {                                                                           //\n-        $this-\u003ename = $name;                                                    //\n+        return $this-\u003ename;                                                     //\n     }                                                                           //\n                                                                                 //\n-    public function isEnabled()                                                 //\n+    public function setName($name)                                              //\n     {                                                                           //\n-        return $this-\u003eenabled;                                                  //\n+        $this-\u003ename = $name;                                                    //\n     }                                                                           //\n                                                                                 //\n-    public function getName()                                                   //\n+    public function getFirstName()                                              //\n     {                                                                           //\n-        return $this-\u003ename;                                                     //\n+        return $this-\u003efirstName;                                                //\n     }                                                                           //\n                                                                                 //\n-    public function getIdentifier()                                             //\n+    public function setFirstName($firstName)                                    //\n     {                                                                           //\n-        return $this-\u003eidentifier;                                               //\n+        $this-\u003efirstName = $firstName;                                          //\n     }                                                                           //\n                                                                                 //\n-    public function getFirstName()                                              //\n+    public function isEnabled()                                                 //\n     {                                                                           //\n-        return $this-\u003efirstName;                                                //\n+        return $this-\u003eenabled;                                                  //\n     }                                                                           //\n                                                                                 //\n     public function enable()                                                    //\n                                                                                 //\n```\n\n## PedroTroller/exceptions_punctuation\n\nException messages MUST ends by \".\", \"…\", \"?\" or \"!\".\u003cbr /\u003e\u003cbr /\u003e\u003ci\u003eRisky: will change the exception message.\u003c/i\u003e\n\n### Configuration examples\n\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    [\n        // ...\n        'PedroTroller/exceptions_punctuation' =\u003e true,\n        // ...\n    ]\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n**OR** using my [rule list builder](doc/rule-set-factory.md).\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    PedroTroller\\CS\\Fixer\\RuleSetFactory::create()\n        -\u003eenable('PedroTroller/exceptions_punctuation')\n        -\u003egetRules()\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n\n### Fixes\n\n```diff\n--- Original                                                                     // 80 chars\n+++ New                                                                          //\n@@ @@                                                                            //\n class MyClass {                                                                 //\n     public function fun1()                                                      //\n     {                                                                           //\n-        throw new \\Exception('This is the message');                            //\n+        throw new \\Exception('This is the message.');                           //\n     }                                                                           //\n                                                                                 //\n     public function fun2($data)                                                 //\n     {                                                                           //\n-        throw new LogicException(sprintf('This is the %s', 'message'));         //\n+        throw new LogicException(sprintf('This is the %s.', 'message'));        //\n     }                                                                           //\n }                                                                               //\n                                                                                 //\n```\n\n## PedroTroller/forbidden_functions\n\nProhibited functions MUST BE commented on as prohibited\n\n\n### Available options\n\n - `comment` (*optional*): The prohibition message to put in the comment\n    - default: `@TODO remove this line`\n\n - `functions` (*optional*): The function names to be marked how prohibited\n    - default: `var_dump`, `dump`, `die`\n\n### Configuration examples\n\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    [\n        // ...\n        'PedroTroller/forbidden_functions' =\u003e [ 'comment' =\u003e 'YOLO' ],\n        // ...\n    ]\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n**OR** using my [rule list builder](doc/rule-set-factory.md).\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    PedroTroller\\CS\\Fixer\\RuleSetFactory::create()\n        -\u003eenable('PedroTroller/forbidden_functions', [ 'comment' =\u003e 'YOLO' ])\n        -\u003egetRules()\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n\n### Fixes\n\n```diff\n--- Original                                                                     // 80 chars\n+++ New                                                                          //\n@@ @@                                                                            //\n class MyClass {                                                                 //\n     public function fun()                                                       //\n     {                                                                           //\n-        var_dump('this is a var_dump');                                         //\n+        var_dump('this is a var_dump'); // YOLO                                 //\n                                                                                 //\n         $this-\u003edump($this);                                                     //\n                                                                                 //\n                                                                                 //\n```\n### Configuration examples\n\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    [\n        // ...\n        'PedroTroller/forbidden_functions' =\u003e [ 'comment' =\u003e 'NEIN NEIN NEIN !!!', 'functions' =\u003e [ 'var_dump', 'var_export' ] ],\n        // ...\n    ]\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n**OR** using my [rule list builder](doc/rule-set-factory.md).\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    PedroTroller\\CS\\Fixer\\RuleSetFactory::create()\n        -\u003eenable('PedroTroller/forbidden_functions', [ 'comment' =\u003e 'NEIN NEIN NEIN !!!', 'functions' =\u003e [ 'var_dump', 'var_export' ] ])\n        -\u003egetRules()\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n\n### Fixes\n\n```diff\n--- Original                                                                     // 80 chars\n+++ New                                                                          //\n@@ @@                                                                            //\n class MyClass {                                                                 //\n     public function fun()                                                       //\n     {                                                                           //\n-        var_dump('this is a var_dump');                                         //\n+        var_dump('this is a var_dump'); // NEIN NEIN NEIN !!!                   //\n                                                                                 //\n         $this-\u003edump($this);                                                     //\n                                                                                 //\n-        return var_export($this);                                               //\n+        return var_export($this); // NEIN NEIN NEIN !!!                         //\n     }                                                                           //\n                                                                                 //\n     public function dump($data)                                                 //\n                                                                                 //\n```\n\n## PedroTroller/line_break_between_method_arguments\n\nIf the declaration of a method is too long, the arguments of this method MUST BE separated (one argument per line)\n\n\n### Available options\n\n - `automatic-argument-merge` (*optional*): If both conditions are met (the line is not too long and there are not too many arguments), then the arguments are put back inline\n    - default: `true`\n\n - `inline-attributes` (*optional*): In the case of a split, the declaration of the attributes of the arguments of the method will be on the same line as the arguments themselves\n    - default: `false`\n\n - `max-args` (*optional*): The maximum number of arguments allowed with splitting the arguments into several lines (use `false` to disable this feature)\n    - default: `3`\n\n - `max-length` (*optional*): The maximum number of characters allowed with splitting the arguments into several lines\n    - default: `120`\n\n### Configuration examples\n\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    [\n        // ...\n        'PedroTroller/line_break_between_method_arguments' =\u003e [ 'max-args' =\u003e 4, 'max-length' =\u003e 120, 'automatic-argument-merge' =\u003e true, 'inline-attributes' =\u003e true ],\n        // ...\n    ]\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n**OR** using my [rule list builder](doc/rule-set-factory.md).\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    PedroTroller\\CS\\Fixer\\RuleSetFactory::create()\n        -\u003eenable('PedroTroller/line_break_between_method_arguments', [ 'max-args' =\u003e 4, 'max-length' =\u003e 120, 'automatic-argument-merge' =\u003e true, 'inline-attributes' =\u003e true ])\n        -\u003egetRules()\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n\n### Fixes\n\n```diff\n--- Original                                                                     // 80 chars\n+++ New                                                                          //\n@@ @@                                                                            //\n         return;                                                                 //\n     }                                                                           //\n                                                                                 //\n-    public function fun2($arg1, array $arg2 = [], \\ArrayAccess $arg3 = null, bool $bool = true, \\Iterator $thisLastArgument = null)\n-    {                                                                           //\n+    public function fun2(                                                       //\n+        $arg1,                                                                  //\n+        array $arg2 = [],                                                       //\n+        \\ArrayAccess $arg3 = null,                                              //\n+        bool $bool = true,                                                      //\n+        \\Iterator $thisLastArgument = null                                      //\n+    ) {                                                                         //\n         return;                                                                 //\n     }                                                                           //\n                                                                                 //\n-    public function fun3(                                                       //\n-        $arg1,                                                                  //\n-        array $arg2 = []                                                        //\n-    ) {                                                                         //\n+    public function fun3($arg1, array $arg2 = [])                               //\n+    {                                                                           //\n         return;                                                                 //\n     }                                                                           //\n }                                                                               //\n                                                                                 //\n```\n### Configuration examples\n\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    [\n        // ...\n        'PedroTroller/line_break_between_method_arguments' =\u003e [ 'max-args' =\u003e false, 'max-length' =\u003e 120, 'automatic-argument-merge' =\u003e true, 'inline-attributes' =\u003e true ],\n        // ...\n    ]\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n**OR** using my [rule list builder](doc/rule-set-factory.md).\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    PedroTroller\\CS\\Fixer\\RuleSetFactory::create()\n        -\u003eenable('PedroTroller/line_break_between_method_arguments', [ 'max-args' =\u003e false, 'max-length' =\u003e 120, 'automatic-argument-merge' =\u003e true, 'inline-attributes' =\u003e true ])\n        -\u003egetRules()\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n\n### Fixes\n\n```diff\n--- Original                                                                     // 80 chars\n+++ New                                                                          //\n@@ @@                                                                            //\n         return;                                                                 //\n     }                                                                           //\n                                                                                 //\n-    public function fun2($arg1, array $arg2 = [], \\ArrayAccess $arg3 = null, bool $bool = true, \\Iterator $thisLastArgument = null)\n-    {                                                                           //\n+    public function fun2(                                                       //\n+        $arg1,                                                                  //\n+        array $arg2 = [],                                                       //\n+        \\ArrayAccess $arg3 = null,                                              //\n+        bool $bool = true,                                                      //\n+        \\Iterator $thisLastArgument = null                                      //\n+    ) {                                                                         //\n         return;                                                                 //\n     }                                                                           //\n                                                                                 //\n-    public function fun3(                                                       //\n-        $arg1,                                                                  //\n-        array $arg2 = []                                                        //\n-    ) {                                                                         //\n+    public function fun3($arg1, array $arg2 = [])                               //\n+    {                                                                           //\n         return;                                                                 //\n     }                                                                           //\n }                                                                               //\n                                                                                 //\n```\n\n## PedroTroller/line_break_between_statements\n\nEach statement (in, for, foreach, ...) MUST BE separated by an empty line\n\n### Configuration examples\n\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    [\n        // ...\n        'PedroTroller/line_break_between_statements' =\u003e true,\n        // ...\n    ]\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n**OR** using my [rule list builder](doc/rule-set-factory.md).\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    PedroTroller\\CS\\Fixer\\RuleSetFactory::create()\n        -\u003eenable('PedroTroller/line_break_between_statements')\n        -\u003egetRules()\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n\n### Fixes\n\n```diff\n--- Original                                                                     // 80 chars\n+++ New                                                                          //\n@@ @@                                                                            //\n         do {                                                                    //\n             // ...                                                              //\n         } while (true);                                                         //\n+                                                                                //\n         foreach (['foo', 'bar'] as $str) {                                      //\n             // ...                                                              //\n         }                                                                       //\n+                                                                                //\n         if (true === false) {                                                   //\n             // ...                                                              //\n         }                                                                       //\n-                                                                                //\n                                                                                 //\n         while (true) {                                                          //\n             // ...                                                              //\n                                                                                 //\n```\n\n## PedroTroller/comment_line_to_phpdoc_block\n\nClassy elements (method, property, ...) comments MUST BE a PhpDoc block\n\n### Configuration examples\n\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    [\n        // ...\n        'PedroTroller/comment_line_to_phpdoc_block' =\u003e true,\n        // ...\n    ]\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n**OR** using my [rule list builder](doc/rule-set-factory.md).\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    PedroTroller\\CS\\Fixer\\RuleSetFactory::create()\n        -\u003eenable('PedroTroller/comment_line_to_phpdoc_block')\n        -\u003egetRules()\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n\n### Fixes\n\n```diff\n--- Original                                                                     // 80 chars\n+++ New                                                                          //\n@@ @@                                                                            //\n      */                                                                         //\n     private $name;                                                              //\n                                                                                 //\n-    // @var string | null                                                       //\n+    /**                                                                         //\n+     * @var string | null                                                       //\n+     */                                                                         //\n     private $value;                                                             //\n                                                                                 //\n     /**                                                                         //\n@@ @@                                                                            //\n         $this-\u003ename = $name;                                                    //\n     }                                                                           //\n                                                                                 //\n-    // Get the name                                                             //\n-    //                                                                          //\n-    // @return string                                                           //\n+    /**                                                                         //\n+     * Get the name                                                             //\n+     *                                                                          //\n+     * @return string                                                           //\n+     */                                                                         //\n     public function getName()                                                   //\n     {                                                                           //\n         return $this-\u003ename;                                                     //\n     }                                                                           //\n                                                                                 //\n-    // Get the value                                                            //\n-    // @return null | string                                                    //\n+    /**                                                                         //\n+     * Get the value                                                            //\n+     * @return null | string                                                    //\n+     */                                                                         //\n     public function getValue()                                                  //\n     {                                                                           //\n         return $this-\u003evalue;                                                    //\n     }                                                                           //\n                                                                                 //\n-    // Set the value                                                            //\n-                                                                                //\n-    // @param string $value                                                     //\n+    /**                                                                         //\n+     * Set the value                                                            //\n+     * @param string $value                                                     //\n+     */                                                                         //\n     public function setValue($value)                                            //\n     {                                                                           //\n         $this-\u003evalue = $value;                                                  //\n     }                                                                           //\n }                                                                               //\n                                                                                 //\n```\n\n## PedroTroller/useless_code_after_return\n\nAll `return` that are not accessible (i.e. following another `return`) MUST BE deleted\n\n### Configuration examples\n\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    [\n        // ...\n        'PedroTroller/useless_code_after_return' =\u003e true,\n        // ...\n    ]\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n**OR** using my [rule list builder](doc/rule-set-factory.md).\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    PedroTroller\\CS\\Fixer\\RuleSetFactory::create()\n        -\u003eenable('PedroTroller/useless_code_after_return')\n        -\u003egetRules()\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n\n### Fixes\n\n```diff\n--- Original                                                                     // 80 chars\n+++ New                                                                          //\n@@ @@                                                                            //\n      */                                                                         //\n     public function fun1(Model\\User $user, Model\\Address $address = null) {     //\n         return;                                                                 //\n-                                                                                //\n-        $user-\u003esetName('foo');                                                  //\n-                                                                                //\n-        return $this;                                                           //\n     }                                                                           //\n                                                                                 //\n     /**                                                                         //\n@@ @@                                                                            //\n         switch ($this-\u003estatus) {                                                //\n             case 1:                                                             //\n                 return $this-\u003ename;                                             //\n-                break;                                                          //\n             default:                                                            //\n                 return $this;                                                   //\n-                return $this;                                                   //\n         }                                                                       //\n     }                                                                           //\n                                                                                 //\n@@ @@                                                                            //\n      */                                                                         //\n     public function buildCallable()                                             //\n     {                                                                           //\n-        return function () { return true; return false; };                      //\n+        return function () { return true; };                                    //\n     }                                                                           //\n }                                                                               //\n                                                                                 //\n```\n\n## PedroTroller/doctrine_migrations\n\nUnnecessary empty methods (`getDescription()`, `up()`, `down()`) and comments MUST BE removed from Doctrine migrations\n\n\n### Available options\n\n - `instanceof` (*optional*): The parent class of which Doctrine migrations extend\n    - default: `Doctrine\\Migrations\\AbstractMigration`\n\n### Configuration examples\n\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    [\n        // ...\n        'PedroTroller/doctrine_migrations' =\u003e true,\n        // ...\n    ]\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n**OR** using my [rule list builder](doc/rule-set-factory.md).\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    PedroTroller\\CS\\Fixer\\RuleSetFactory::create()\n        -\u003eenable('PedroTroller/doctrine_migrations')\n        -\u003egetRules()\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n\n### Fixes\n\n```diff\n--- Original                                                                     // 80 chars\n+++ New                                                                          //\n@@ @@                                                                            //\n use Doctrine\\DBAL\\Schema\\Schema;                                                //\n use Doctrine\\Migrations\\AbstractMigration;                                      //\n                                                                                 //\n-/**                                                                             //\n- * Auto-generated Migration: Please modify to your needs!                       //\n- */                                                                             //\n final class Version20190323095102 extends AbstractMigration                     //\n {                                                                               //\n-    public function getDescription()                                            //\n-    {                                                                           //\n-        return '';                                                              //\n-    }                                                                           //\n                                                                                 //\n     public function up(Schema $schema)                                          //\n     {                                                                           //\n-        // this up() migration is auto-generated, please modify it to your needs//\n         $this-\u003eabortIf('mysql' !== $this-\u003econnection-\u003egetDatabasePlatform()-\u003egetName(), 'Migration can only be executed safely on \\'mysql\\'.');\n                                                                                 //\n         $this-\u003eaddSql('CREATE TABLE admin (identifier CHAR(36) NOT NULL COMMENT \\'(DC2Type:guid)\\', PRIMARY KEY(identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');\n@@ @@                                                                            //\n                                                                                 //\n     public function down(Schema $schema)                                        //\n     {                                                                           //\n-        // this down() migration is auto-generated, please modify it to your needs\n         $this-\u003eabortIf('mysql' !== $this-\u003econnection-\u003egetDatabasePlatform()-\u003egetName(), 'Migration can only be executed safely on \\'mysql\\'.');\n                                                                                 //\n         $this-\u003eaddSql('DROP TABLE admin');                                      //\n     }                                                                           //\n }                                                                               //\n                                                                                 //\n```\n### Configuration examples\n\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    [\n        // ...\n        'PedroTroller/doctrine_migrations' =\u003e [ 'instanceof' =\u003e [ 'Doctrine\\Migrations\\AbstractMigration' ] ],\n        // ...\n    ]\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n**OR** using my [rule list builder](doc/rule-set-factory.md).\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    PedroTroller\\CS\\Fixer\\RuleSetFactory::create()\n        -\u003eenable('PedroTroller/doctrine_migrations', [ 'instanceof' =\u003e [ 'Doctrine\\Migrations\\AbstractMigration' ] ])\n        -\u003egetRules()\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n\n### Fixes\n\n```diff\n--- Original                                                                     // 80 chars\n+++ New                                                                          //\n@@ @@                                                                            //\n use Doctrine\\DBAL\\Schema\\Schema;                                                //\n use Doctrine\\Migrations\\AbstractMigration;                                      //\n                                                                                 //\n-/**                                                                             //\n- * Auto-generated Migration: Please modify to your needs!                       //\n- */                                                                             //\n final class Version20190323095102 extends AbstractMigration                     //\n {                                                                               //\n-    public function getDescription()                                            //\n-    {                                                                           //\n-        return '';                                                              //\n-    }                                                                           //\n                                                                                 //\n     public function up(Schema $schema)                                          //\n     {                                                                           //\n-        // this up() migration is auto-generated, please modify it to your needs//\n         $this-\u003eabortIf('mysql' !== $this-\u003econnection-\u003egetDatabasePlatform()-\u003egetName(), 'Migration can only be executed safely on \\'mysql\\'.');\n                                                                                 //\n         $this-\u003eaddSql('CREATE TABLE admin (identifier CHAR(36) NOT NULL COMMENT \\'(DC2Type:guid)\\', PRIMARY KEY(identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');\n@@ @@                                                                            //\n                                                                                 //\n     public function down(Schema $schema)                                        //\n     {                                                                           //\n-        // this down() migration is auto-generated, please modify it to your needs\n         $this-\u003eabortIf('mysql' !== $this-\u003econnection-\u003egetDatabasePlatform()-\u003egetName(), 'Migration can only be executed safely on \\'mysql\\'.');\n                                                                                 //\n         $this-\u003eaddSql('DROP TABLE admin');                                      //\n     }                                                                           //\n }                                                                               //\n                                                                                 //\n```\n\n## PedroTroller/phpspec\n\nPhpspec scenario functions MUST NOT have a return type declaration.\n\nPhpspec scenario functions MUST NOT have a scope.\n\nThe methods of the phpspec specification classes MUST BE sorted (let, letGo, its_*, it_*, getMatchers and the rest of the methods)\n\nLambda functions MUST NOT have a static scope.\n\n\n### Available options\n\n - `instanceof` (*optional*): Parent classes of your spec classes.\n    - default: `PhpSpec\\ObjectBehavior`\n\n### Configuration examples\n\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    [\n        // ...\n        'PedroTroller/phpspec' =\u003e true,\n        // ...\n    ]\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n**OR** using my [rule list builder](doc/rule-set-factory.md).\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    PedroTroller\\CS\\Fixer\\RuleSetFactory::create()\n        -\u003eenable('PedroTroller/phpspec')\n        -\u003egetRules()\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n\n### Fixes\n\n```diff\n--- Original                                                                     // 80 chars\n+++ New                                                                          //\n@@ @@                                                                            //\n class TheSpec extends ObjectBehavior                                            //\n {                                                                               //\n                                                                                 //\n-    function letGo($file) {                                                     //\n+    function let($file) {                                                       //\n         return;                                                                 //\n     }                                                                           //\n                                                                                 //\n-    private function thePrivateMethod() {                                       //\n+    function letGo($file) {                                                     //\n         return;                                                                 //\n     }                                                                           //\n                                                                                 //\n-    public function itIsNotASpec($file) {                                       //\n+    function it_is_a_spec($file) {                                              //\n         return;                                                                 //\n     }                                                                           //\n                                                                                 //\n-    public function it_is_a_spec($file) {                                       //\n+    function its_other_function($file) {                                        //\n         return;                                                                 //\n     }                                                                           //\n                                                                                 //\n-    public function let($file) {                                                //\n+    private function thePrivateMethod() {                                       //\n         return;                                                                 //\n     }                                                                           //\n                                                                                 //\n-    public function its_other_function($file) {                                 //\n+    public function itIsNotASpec($file) {                                       //\n         return;                                                                 //\n     }                                                                           //\n }                                                                               //\n                                                                                 //\n```\n### Configuration examples\n\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    [\n        // ...\n        'PedroTroller/phpspec' =\u003e [ 'instanceof' =\u003e [ 'PhpSpec\\ObjectBehavior' ] ],\n        // ...\n    ]\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n**OR** using my [rule list builder](doc/rule-set-factory.md).\n```php\n// .php_cs.dist\n\u003c?php\n\n$config = new PhpCsFixer\\Config();\n// ...\n$config-\u003esetRules(\n    PedroTroller\\CS\\Fixer\\RuleSetFactory::create()\n        -\u003eenable('PedroTroller/phpspec', [ 'instanceof' =\u003e [ 'PhpSpec\\ObjectBehavior' ] ])\n        -\u003egetRules()\n);\n$config-\u003eregisterCustomFixers(new PedroTroller\\CS\\Fixer\\Fixers());\n// ...\n\nreturn $config;\n```\n\n### Fixes\n\n```diff\n--- Original                                                                     // 80 chars\n+++ New                                                                          //\n@@ @@                                                                            //\n class TheSpec extends ObjectBehavior                                            //\n {                                                                               //\n                                                                                 //\n-    function letGo($file) {                                                     //\n+    function let($file) {                                                       //\n         return;                                                                 //\n     }                                                                           //\n                                                                                 //\n-    private function thePrivateMethod() {                                       //\n+    function letGo($file) {                                                     //\n         return;                                                                 //\n     }                                                                           //\n                                                                                 //\n-    public function itIsNotASpec($file) {                                       //\n+    function it_is_a_spec($file) {                                              //\n         return;                                                                 //\n     }                                                                           //\n                                                                                 //\n-    public function it_is_a_spec($file) {                                       //\n+    function its_other_function($file) {                                        //\n         return;                                                                 //\n     }                                                                           //\n                                                                                 //\n-    public function let($file) {                                                //\n+    private function thePrivateMethod() {                                       //\n         return;                                                                 //\n     }                                                                           //\n                                                                                 //\n-    public function its_other_function($file) {                                 //\n+    public function itIsNotASpec($file) {                                       //\n         return;                                                                 //\n     }                                                                           //\n }                                                                               //\n                                                                                 //\n```\n\n# Contributions\n\nBefore to create a pull request to submit your contributon, you must:\n - run tests and be sure nothing is broken\n - rebuilt the documentation\n\n## How to run tests\n\n```bash\ncomposer tests\n```\n\n## How to rebuild the documentation\n\n```bash\nbin/doc \u003e README.md\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedrotroller%2Fphpcsfixer-custom-fixers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpedrotroller%2Fphpcsfixer-custom-fixers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedrotroller%2Fphpcsfixer-custom-fixers/lists"}