genealabs / php-coding-standards
Installs: 46 090
Dependents: 1
Suggesters: 0
Security: 0
Stars: 15
Watchers: 2
Forks: 0
Language:Shell
Requires
- php: ^8.0
- slevomat/coding-standard: ^7.0
- squizlabs/php_codesniffer: ^3.5
README
Custom PHPCS sniffs that support all our coding standards.
Installation
There are several ways to install this ruleset:
- Add the following to your composer.json scripts section:
"post-update-cmd" : [
"tools/phpcs --config-set installed_paths vendor/genealabs/php-coding-standards/src/GeneaLabs"
]
- Or add the following to your phpcs.xml file:
<ruleset>
<rule ref="./vendor/genealabs/php-coding-standards/src/GeneaLabs/ruleset.xml"/>
</ruleset>
Custom Rules
Type Hinting
- Method Parameter Type Hints
- Method Return Type Hints
Whitespace
- Empty Lines Acound Control Structures
- Empyt Line Before Returns
- No Mutliple Consecutive Empty Lines
Adopted Rules
- PSR1
- PSR2
- PSR12
- except: PSR12.Classes.ClassInstantiation.MissingParentheses, as we want to new up classes without parenthesis.
- Internal.NoCodeFound
- Zend.Files.ClosingTag
- Zend.NamingConventions
- except: Zend.NamingConventions.ValidVariableName.PrivateNoUnderscore, as we want all variables and properties to be in camelCase.