The following insights are organised in differents metrics :

  • NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Classes Architecture\Classes
  • NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Composer Architecture\Composer
  • NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Constants Architecture\Constants
  • NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Files Architecture\Files
  • NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Functions Architecture\Functions
  • NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Interfaces Architecture\Interfaces
  • NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Namespaces Architecture\Namespaces
  • NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Traits Architecture\Traits

Forbidden normal classes ^1.0 Architecture\Classes

This insight disallows usage of normal classes. A Class must be abstract or final.

Insight Class: NunoMaduro\PhpInsights\Domain\Insights\ForbiddenNormalClasses

Valid class name ^1.0 Architecture\Classes

This sniff ensures classes are in camel caps, and the first letter is capitalised.

Insight Class: PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff

Class declaration ^1.0 Architecture\Classes

This sniff checks if the declaration of the class is correct

Insight Class: PHP_CodeSniffer\Standards\PSR1\Sniffs\Classes\ClassDeclarationSniff

Class trait and interface length ^1.0 Architecture\Classes configurable

This sniff checks the size of your classes/traits/interface

Insight Class: ObjectCalisthenics\Sniffs\Files\ClassTraitAndInterfaceLengthSniff

\ObjectCalisthenics\Sniffs\Files\ClassTraitAndInterfaceLengthSniff::class => [
    'maxLength' => 200,

Method per class limit ^1.0 Architecture\Classes configurable

This sniff checks if the number of methods per class is under a limit.

Insight Class: ObjectCalisthenics\Sniffs\Metrics\MethodPerClassLimitSniff

\ObjectCalisthenics\Sniffs\Metrics\MethodPerClassLimitSniff::class => [
    'maxCount' => 10,

Property per class limit ^1.0 Architecture\Classes configurable

This sniff checks if the number of properties per class is under a limit.

Insight Class: ObjectCalisthenics\Sniffs\Metrics\PropertyPerClassLimitSniff

\ObjectCalisthenics\Sniffs\Metrics\PropertyPerClassLimitSniff::class => [
    'maxCount' => 10,

One class per file ^1.0 Architecture\Classes

This sniff checks that only one class is declared per file.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Files\OneClassPerFileSniff

Superfluous interface naming ^1.0 Architecture\Classes

This sniff reports use of superfluous prefix or suffix "Interface" for interfaces.

Insight Class: SlevomatCodingStandard\Sniffs\Classes\SuperfluousInterfaceNamingSniff

Superfluous abstract class naming ^1.0 Architecture\Classes

This sniff reports use of superfluous prefix or suffix "Abstract" for abstract classes.

Insight Class: SlevomatCodingStandard\Sniffs\Classes\SuperfluousAbstractClassNamingSniff

composer.json must exist ^1.0 Architecture\Composer

This insight verifies there is composer.json.

Insight Class: NunoMaduro\PhpInsights\Domain\Insights\Composer\ComposerMustExist

The name property in the composer.json ^1.0 Architecture\Composer

This insight checks if the name section in composer.json contains default values (e.g. laravel/laravel or symfony/symfony).

Insight Class: NunoMaduro\PhpInsights\Domain\Insights\Composer\ComposerMustContainName

Composer.json must be valid ^1.7 Architecture\Composer

This insight checks if the composer.json is valid.

Insight Class: NunoMaduro\PhpInsights\Domain\Insights\Composer\ComposerMustBeValid

Composer.lock must be fresh ^1.7 Architecture\Composer

This insight verifies that the composer.lock is not outdated.

Insight Class: NunoMaduro\PhpInsights\Domain\Insights\Composer\ComposerLockMustBeFresh

Define globals is prohibited ^1.0 Architecture\Constants

This insight disallows defining globals.

Insight Class: NunoMaduro\PhpInsights\Domain\Insights\ForbiddenDefineGlobalConstants

Superfluous Exception Naming ^1.0 Architecture\Files

This sniff reports use of superfluous prefix or suffix "Exception" for exceptions.

Insight Class: SlevomatCodingStandard\Sniffs\Classes\SuperfluousExceptionNamingSniff

Function length ^1.0 Architecture\Functions configurable

This sniff checks the size of functions

Insight Class: ObjectCalisthenics\Sniffs\Files\FunctionLengthSniff

\ObjectCalisthenics\Sniffs\Files\FunctionLengthSniff::class => [
    'maxLength' => 20,

One interface per file ^1.0 Architecture\Interfaces

This sniff checks that only one interface is declared per file.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Files\OneInterfacePerFileSniff

Namespace declaration ^1.0 Architecture\Namespaces

This 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

Useless Alias ^1.0 Architecture\Namespaces

This sniff looks for use alias that is the same as the unqualified name.

Insight Class: SlevomatCodingStandard\Sniffs\Namespaces\UselessAliasSniff

Compound namespace depth ^1.0 Architecture\Namespaces

This sniff verifies that compound namespaces are not defined too deep.

Insight Class: PHP_CodeSniffer\Standards\PSR12\Sniffs\Namespaces\CompoundNamespaceDepthSniff

Forbidden traits ^1.0 Architecture\Traits

This insight disallows trait usage.

Insight Class: NunoMaduro\PhpInsights\Domain\Insights\ForbiddenTraits

One trait per file ^1.0 Architecture\Traits

This sniff checks that only one trait is declared per file

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Files\OneTraitPerFileSniff

Superfluous trait naming ^1.0 Architecture\Traits

This sniff reports use of superfluous prefix or suffix "Trait" for traits.

Insight Class: SlevomatCodingStandard\Sniffs\Classes\SuperfluousTraitNamingSniff

Ordered class elements ^1.10 Architecture\Classes configurable

This sniff orders the elements of classes/interfaces/traits.

Insight Class: PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer

\PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer::class => [
    'order' => [ // List of strings defining order of elements.
    'sortAlgorithm' => 'none' // possible values ['none', 'alpha']

Single class element per statement ^1.10 Architecture\Classes configurable

There must not be more than one property or constant declared per statement.

Insight Class: PhpCsFixer\Fixer\ClassNotation\SingleClassElementPerStatementFixer

\PhpCsFixer\Fixer\ClassNotation\SingleClassElementPerStatementFixer::class => [
    'elements' => [

Ordered imports ^1.10 Architecture\Classes configurable

This sniff orders use statements (import of classes).

Insight Class: PhpCsFixer\Fixer\Import\OrderedImportsFixer

\PhpCsFixer\Fixer\Import\OrderedImportsFixer::class => [
    'import_order' => ['class', 'const', 'function'],
    'sort_algorithm' => 'alpha', // possible values ['alpha', 'length', 'none']

Single import pert statement ^1.10 Architecture\Classes

There must be one use keyword per declaration.

Insight Class: PhpCsFixer\Fixer\Import\SingleImportPerStatementFixer

Protected to private ^1.10 Architecture\Functions

This fixer converts protected variables and methods to private where possible.

Insight Class: PhpCsFixer\Fixer\ClassNotation\ProtectedToPrivateFixer

Method argument space ^1.10 Architecture\Functions configurable

In 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

\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']

Void return ^1.10 Architecture\Functions

This fixer adds a void return type to functions with missing or empty return statements, but priority is given to @return annotations.

Insight Class: PhpCsFixer\Fixer\FunctionNotation\VoidReturnFixer