IssueRaiser

PSR-12 / PER-CS v1 Support

[PSR-12](https://www.php-fig.org/psr/psr-12/) just got approved. [PER-CS v1](https://groups.google.com/g/php-fig/c/bBh4Y-R5gxE) is the same in terms of rules, so all the changes must be included in both of them (`@PSR12`, `@PER-CS1.0`). I think PHP CS Fixer already supports almost all of its rules. The missing cases I could notice are the following: --- [3. Declare Statements, Namespace, and Import Statements](https://www.php-fig.org/psr/psr-12/#3-declare-statements-namespace-and-import-statements) > The header of a PHP file may consist of a number of different blocks. If present, each of the blocks below MUST be separated by a single blank line, and MUST NOT contain a blank line. Each block MUST be in the order listed below, although blocks that are not relevant may be omitted. > > - Opening `<?php` tag. > - File-level docblock. > - One or more declare statements. > - The namespace declaration of the file. > - One or more class-based `use` import statements. > - One or more function-based `use` import statements. > - One or more constant-based `use` import statements. > - The remainder of the code in the file. `ordered_imports` currently sorts imports without considering their type. We should add an option to sort by type first. We should also add an option (or dedicated rule) to add a separation line between each import group. --- - [5.1 if, elseif, else](https://www.php-fig.org/psr/psr-12/#51-if-elseif-else); - [5.2 switch, case](https://www.php-fig

Posted by julienfalque on Aug 12, 2019, 2:50 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments

support (E-commerce)

PSR-12 / PER-CS v1 Support

julienfalqueAug 12, 2019, 2:50 PM

[PSR-12](https://www.php-fig.org/psr/psr-12/) just got approved. [PER-CS v1](https://groups.google.com/g/php-fig/c/bBh4Y-R5gxE) is the same in terms of rules, so all the changes must be included in both of them (`@PSR12`, `@PER-CS1.0`). I think PHP CS Fixer already supports almost all of its rules. The missing cases I could notice are the following: --- [3. Declare Statements, Namespace, and Import Statements](https://www.php-fig.org/psr/psr-12/#3-declare-statements-namespace-and-import-statements) > The header of a PHP file may consist of a number of different blocks. If present, each of the blocks below MUST be separated by a single blank line, and MUST NOT contain a blank line. Each block MUST be in the order listed below, although blocks that are not relevant may be omitted. > > - Opening `<?php` tag. > - File-level docblock. > - One or more declare statements. > - The namespace declaration of the file. > - One or more class-based `use` import statements. > - One or more function-based `use` import statements. > - One or more constant-based `use` import statements. > - The remainder of the code in the file. `ordered_imports` currently sorts imports without considering their type. We should add an option to sort by type first. We should also add an option (or dedicated rule) to add a separation line between each import group. --- - [5.1 if, elseif, else](https://www.php-fig.org/psr/psr-12/#51-if-elseif-else); - [5.2 switch, case](https://www.php-fig

Comments (0)

No comments yet. Start the discussion.

Comment on this issue