11# TYPO3 Coding Standards Package
22
3- You know the feeling: You work on your own extension, and then contribute to TYPO3, and TYPO3 delivers all the nice
4- things to check for proper coding standards.
3+ You know the feeling: You work on your own extension, and then contribute to
4+ TYPO3, and TYPO3 delivers all the nice things to check for proper coding
5+ standards.
56
6- Well, same happens to all of us! Luckily, TYPO3 has this configuration in Core, and it's now available separately
7- - ready to plug-and-play for you!
7+ Well, same happens to all of us! Luckily, TYPO3 has this configuration in Core,
8+ and it's now available separately - ready to plug-and-play for you!
89
9- It does not matter if you're an extension developer, or a TYPO3 contributor, or working on your TYPO3 project.
10+ It does not matter if you're an extension developer, or a TYPO3 contributor, or
11+ working on your TYPO3 project.
1012
1113## Installation
1214
13- As this is a composer package, execute ` composer req --dev typo3/coding-standards ` in your composer project.
15+ As this is a composer package, execute ` composer req --dev typo3/coding-standards `
16+ in your composer project.
1417
1518## What's in the package?
1619
17- The coding guidelines that are used in TYPO3 Core development. Instead of putting this information in our main
18- repository, it should be helpful to apply certain rules to other projects as well. TYPO3 is more than just TYPO3 Core!
20+ The coding guidelines that are used in TYPO3 Core development. Instead of
21+ putting this information in our main repository, it should be helpful to apply
22+ certain rules to other projects as well. TYPO3 is more than just TYPO3 Core!
1923
20- 1 . PHP-CS-Fixer rules
24+ ### PHP-CS-Fixer rules
2125
2226Making sure your PHP files apply to the same rules.
2327
24- 2 . .editorconfig
28+ ### .editorconfig
2529
26- If you work on a team, and you use different IDE settings, ` .editorconfig ` helps you to have the same settings
27- across all editors. It does not matter if it is VS-Code, vim or PhpStorm.
30+ If you work on a team, and you use different IDE settings, ` .editorconfig `
31+ helps you to have the same settings across all editors. It does not matter if
32+ it is VS-Code, vim or PhpStorm.
2833
2934### Setting up the TYPO3 rulesets as boilerplate
3035
3136Our coding standards file can set this up for you. Run
3237
33- php vendor/typo3/coding-standards/setup.php project
34- php vendor/typo3/coding-standards/setup.php extension
38+ ``` bash
39+ php vendor/typo3/coding-standards/setup.php project
40+ php vendor/typo3/coding-standards/setup.php extension
41+ ```
3542
3643or if you want to update the rules, add ` -f ` option to the end.
3744
3845Have a look at the newly created files in your root folder:
3946
40- - .php_cs
47+ - .php_cs
4148- .editorconfig
4249
43- For projects, the folder ` src/extensions ` is configured by default, but you can accommodate where your extensions
44- or PHP code resides in. For extensions, PHP-CS-Fixer scans the whole base directory.
50+ For projects, the folder ` src/extensions ` is configured by default, but you can
51+ accommodate where your extensions or PHP code resides in. For extensions,
52+ PHP-CS-Fixer scans the whole base directory.
4553
46- In addition, you can configure your PHP-CS-Fixer cache file folder and other configurations just like with PHP-CS-Fixer.
54+ In addition, you can configure your PHP-CS-Fixer cache file folder and other
55+ configurations just like with PHP-CS-Fixer.
4756
48-
49- You can decide to commit them to your Git repository, which is the recommended way.
57+ You can decide to commit them to your Git repository, which is the recommended
58+ way.
5059
5160## Executing the PHP-CS-Fixer
5261
5362Once you've followed the step above, running PHP CS Fixer works like this:
5463
55- composer exec php-cs-fixer
56-
57- Leave a note on how you set it up on GitHub Actions or GitLab CI/CD so this document can be even more helpful
58- for everybody.
64+ ``` bash
65+ composer exec php-cs-fixer
66+ ```
5967
68+ Leave a note on how you set it up on GitHub Actions or GitLab CI/CD so this
69+ document can be even more helpful for everybody.
6070
6171## What's next?
6272
63- We'd love to ship out license headers for all PHP files, however there are certain limitations (namespace must
64- be underneath the license headers), which why this option is not enabled by default.
73+ We'd love to ship out license headers for all PHP files, however there are
74+ certain limitations (namespace must be underneath the license headers), which
75+ why this option is not enabled by default.
6576
6677## A note about our standards
6778
6879### PHP Coding Guidelines
6980
70- TYPO3's coding guidelines have evolved over time. And we are happy to have PHP-FIG and PSR-1/PSR-2 and PSR-12.
71- That's why we're committed to following these guidelines.
81+ TYPO3's coding guidelines have evolved over time. And we are happy to have
82+ PHP-FIG and PSR-1/PSR-2 and PSR-12. That's why we're committed to following
83+ these guidelines.
7284
7385However, there are some more rules that we think are good:
7486
@@ -81,14 +93,17 @@ However, there are some more rules that we think are good:
8193
8294## Maintaining and Development of this package
8395
84- This package is not meant to be updated regularly, since talking about coding guidelines takes a lot of time, and
85- is usual a matter of taste. Nonetheless, you can always open up an issue if you feel like we're missing out on something.
96+ This package is not meant to be updated regularly, since talking about coding
97+ guidelines takes a lot of time, and is usual a matter of taste. Nonetheless,
98+ you can always open up an issue if you feel like we're missing out on something.
8699
87100## License & Thanks
88101
89- This package is available under the MIT license, since it relies heavily on the PHP-CS-Fixer code.
102+ This package is available under the MIT license, since it relies heavily on the
103+ PHP-CS-Fixer code.
90104
91- In addition, I would like to thank the TYPO3 Core Team that kickstarted this set of rules in 2015, and to the
92- creators and maintainers of PHP-CS-Fixer package.
105+ In addition, I would like to thank the TYPO3 Core Team that kickstarted this
106+ set of rules in 2015, and to the creators and maintainers of PHP-CS-Fixer
107+ package.
93108
94109Benni Mack, TYPO3 Project Lead
0 commit comments