tzachi/coding-standard

Coding Standard for TZachi's projects

Installs: 152

Dependents: 1

Suggesters: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:phpcodesniffer-standard

0.1.1 2019-04-21 10:12 UTC

README

License Build Status Total Downloads Latest Stable Version Unstable Version

This project has a set of PHP_CodeSniffer rules that are based on doctrine/coding-standard rules, but with some small changes and additions.

Differences from doctrine coding-standards

  • Inline comments should begin with a space, for example: // This is an inline comment
  • Docblock annotation groups are grouped a bit different
  • Empty catch in try...catch must have a comment explaining why the exception is not handled
  • There shouldn't be a space after the negation operator if (!$cond)
  • No space before colon in return type: public function test(): void
  • Property doc comments shouldn't be a single line, but multiline instead:
/**
 * @var int
 */
  • Variable/property/function names should be camelCased: $camelCaseVariable
  • A @throw tag comment doesn't need to end in full stop:
class Abc
{
    /**
     * @throw InvalidArgumentException This is a comment that doesn't end in a full stop
     */
    public function def(): void
    {
        ...
}