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
Requires
- consistence/coding-standard: ~0.11.1
- slevomat/coding-standard: ~1.1.0
- squizlabs/php_codesniffer: ~2.6.2
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).
- There is no exception for dirs such as
Additional rules
- Methods in facades/services/finders (generally non-value-representation based classes) follow these rules for naming methods:
- Method starting with
get...
never returnsNULL
(it should throw an Exception if the expected type can not be returned). - Method starting with
find...
returns expected type orNULL
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, notcount...
.
- Method starting with