Architecture
The following insights are organised in different metrics :
NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Classes
Architecture\ClassesNunoMaduro\PhpInsights\Domain\Metrics\Architecture\Constants
Architecture\ConstantsNunoMaduro\PhpInsights\Domain\Metrics\Architecture\Files
Architecture\FilesNunoMaduro\PhpInsights\Domain\Metrics\Architecture\Functions
Architecture\FunctionsNunoMaduro\PhpInsights\Domain\Metrics\Architecture\Interfaces
Architecture\InterfacesNunoMaduro\PhpInsights\Domain\Metrics\Architecture\Namespaces
Architecture\NamespacesNunoMaduro\PhpInsights\Domain\Metrics\Architecture\Traits
Architecture\Traits
^1.0 Architecture\Classes
Forbidden normal classesThis insight disallows usage of normal classes. A Class must be abstract
or final
.
Insight Class: NunoMaduro\PhpInsights\Domain\Insights\ForbiddenNormalClasses
^1.0 Architecture\Classes
Valid class nameThis sniff ensures classes are in camel caps, and the first letter is capitalised.
Insight Class: PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff
^1.0 Architecture\Classes
Class declarationThis sniff checks if the declaration of the class is correct
Insight Class: PHP_CodeSniffer\Standards\PSR1\Sniffs\Classes\ClassDeclarationSniff
>=1.0 <2.0 Architecture\Classes configurable
Class trait and interface lengthThis sniff checks the size of your classes/traits/interface
Insight Class: ObjectCalisthenics\Sniffs\Files\ClassTraitAndInterfaceLengthSniff
Configuration
\ObjectCalisthenics\Sniffs\Files\ClassTraitAndInterfaceLengthSniff::class => [
'maxLength' => 200,
]
>=1.0 <2.0 Architecture\Classes configurable
Method per class limitThis sniff checks if the number of methods per class is under a limit.
Insight Class: ObjectCalisthenics\Sniffs\Metrics\MethodPerClassLimitSniff
Configuration
\ObjectCalisthenics\Sniffs\Metrics\MethodPerClassLimitSniff::class => [
'maxCount' => 10,
]
>=1.0 <2.0 Architecture\Classes configurable
Property per class limitThis sniff checks if the number of properties per class is under a limit.
Insight Class: ObjectCalisthenics\Sniffs\Metrics\PropertyPerClassLimitSniff
Configuration
\ObjectCalisthenics\Sniffs\Metrics\PropertyPerClassLimitSniff::class => [
'maxCount' => 10,
]
^1.0 Architecture\Classes
One class per fileThis sniff checks that only one class is declared per file.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Files\OneClassPerFileSniff
^1.0 Architecture\Classes
Superfluous interface namingThis sniff reports use of superfluous prefix or suffix "Interface" for interfaces.
Insight Class: SlevomatCodingStandard\Sniffs\Classes\SuperfluousInterfaceNamingSniff
^1.0 Architecture\Classes
Superfluous abstract class namingThis sniff reports use of superfluous prefix or suffix "Abstract" for abstract classes.
Insight Class: SlevomatCodingStandard\Sniffs\Classes\SuperfluousAbstractClassNamingSniff
globals
is prohibited ^1.0 Architecture\Constants
Define This insight disallows defining globals
.
Insight Class: NunoMaduro\PhpInsights\Domain\Insights\ForbiddenDefineGlobalConstants
^1.0 Architecture\Files
Superfluous Exception NamingThis sniff reports use of superfluous prefix or suffix "Exception" for exceptions.
Insight Class: SlevomatCodingStandard\Sniffs\Classes\SuperfluousExceptionNamingSniff
^1.0 Architecture\Functions configurable
Function lengthThis sniff checks the size of functions
Insight Class v1.0: ObjectCalisthenics\Sniffs\Files\FunctionLengthSniff
Configuration
\ObjectCalisthenics\Sniffs\Files\FunctionLengthSniff::class => [
'maxLength' => 20,
]
Insight Class v2.0: SlevomatCodingStandard\Sniffs\Functions\FunctionLengthSniff
Configuration
\SlevomatCodingStandard\Sniffs\Functions\FunctionLengthSniff::class => [
'maxLinesLength' => 20,
]
^1.0 Architecture\Interfaces
One interface per fileThis sniff checks that only one interface is declared per file.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Files\OneInterfacePerFileSniff
^1.0 Architecture\Namespaces
Namespace declarationThis sniff enforces one space after namespace, disallows content between namespace name and semicolon and disallows use of bracketed syntax.
Insight Class: SlevomatCodingStandard\Sniffs\Namespaces\NamespaceDeclarationSniff
^1.0 Architecture\Namespaces
Useless AliasThis sniff looks for use alias that is the same as the unqualified name.
Insight Class: SlevomatCodingStandard\Sniffs\Namespaces\UselessAliasSniff
^1.0 Architecture\Namespaces
Compound namespace depthThis sniff verifies that compound namespaces are not defined too deep.
Insight Class: PHP_CodeSniffer\Standards\PSR12\Sniffs\Namespaces\CompoundNamespaceDepthSniff
^1.0 Architecture\Traits
Forbidden traitsThis insight disallows trait usage.
Insight Class: NunoMaduro\PhpInsights\Domain\Insights\ForbiddenTraits
^1.0 Architecture\Traits
One trait per fileThis sniff checks that only one trait is declared per file
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Files\OneTraitPerFileSniff
^1.0 Architecture\Traits
Superfluous trait namingThis sniff reports use of superfluous prefix or suffix "Trait" for traits.
Insight Class: SlevomatCodingStandard\Sniffs\Classes\SuperfluousTraitNamingSniff
^1.10 Architecture\Functions configurable
Method argument spaceIn method arguments and method calls, there must not be a space before each comma and there must be one space after each comma. Argument lists may be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list must be on the next line, and there must be only one argument per line.
Insight Class: PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer
Configuration
\PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class => [
'after_heredoc' => false,
'ensure_fully_multiline' => false,
'keep_multiple_spaces_after_comma' => false,
'on_multiline' => 'ignore' // possible values ['ignore', 'ensure_single_line', 'ensure_fully_multiline']
]