genealabs/php-coding-standards

Installs: 46 834

Dependents: 1

Suggesters: 0

Security: 0

Stars: 15

Watchers: 2

Forks: 0

Language:Shell

0.2.0 2021-11-18 13:01 UTC

This package is auto-updated.

Last update: 2024-12-05 22:51:46 UTC


README

Custom PHPCS sniffs that support all our coding standards.

Installation

There are several ways to install this ruleset:

  1. 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"
]
  1. 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.