shipito/coding-standard

This package is abandoned and no longer maintained. No replacement package was suggested.

Shipito PHP Coding Standard

0.6.0 2016-11-07 11:58 UTC

This package is auto-updated.

Last update: 2021-02-22 22:38:48 UTC


README

Follow rules defined in the Consistence Coding Standard with differences and additional rules defined below.

Differences from Consistence Coding Standard

  • Uses are not grouped (and separated by an empty line) by top-level namespece.
  • Type, which is implicitly used (from the same namespace), is not extended/implement with FQN.
  • Partial uses are allowed to use in annotations.
  • In @param, @var and @return short form of scalar types is used (bool).
  • PSR0/4 should be followed in all cases.
    • There is no exception for dirs such as .../exceptions or .../data.
    • So Exceptions should be placed alongside other classes (because we do not use namespaces to separate type of files).

Additional rules

  • Methods in facades/services/finders (generally non-value-representation based classes) follow these rules for naming methods:
    • Method starting with get... never returns NULL (it should throw an Exception if the expected type can not be returned).
    • Method starting with find... returns expected type or NULL if it was not found (is not accessible, etc.).
    • Method returning a collection/array is named get..., becase it always returns expected type.
    • Methods returning count of items are also in get/find...Count form, not count....