Code
The following insights are organised in different metrics :
NunoMaduro\PhpInsights\Domain\Metrics\Code\Classes
Code\ClassesNunoMaduro\PhpInsights\Domain\Metrics\Code\Code
Code\CodeNunoMaduro\PhpInsights\Domain\Metrics\Code\Comments
Code\CommentsNunoMaduro\PhpInsights\Domain\Metrics\Code\Functions
Code\FunctionsNunoMaduro\PhpInsights\Domain\Metrics\Code\Globally
Code\Globally
^1.0 Code\Classes
Forbidden public propertyThis sniff disallows public properties.
Insight Class v1.0: ObjectCalisthenics\Sniffs\Classes\ForbiddenPublicPropertySniff
Insight Class v2.0: SlevomatCodingStandard\Sniffs\Classes\ForbiddenPublicPropertySniff
^1.0 Code\Classes
Unused private elementsThis sniff detects unused private elements
Insight Class: SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff
^1.0 Code\Classes
Forbidden setterThis sniff disallows setter methods.
Insight Class: NunoMaduro\PhpInsights\Domain\Sniffs\ForbiddenSetterSniff
^1.0 Code\Classes
Unnecessary Final modifierThis sniff detects unnecessary final modifiers inside of final classes.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\UnnecessaryFinalModifierSniff
^1.0 Code\Classes
Property declarationThis sniff verifies that properties are declared correctly.
Insight Class: PHP_CodeSniffer\Standards\PSR2\Sniffs\Classes\PropertyDeclarationSniff
^1.0 Code\Classes
Class constant visibilityThis sniff requires declaring visibility for all class constants.
Insight Class: SlevomatCodingStandard\Sniffs\Classes\ClassConstantVisibilitySniff
^1.0 Code\Classes
Disallow Late static Binding for constantsThis sniff disallows late static binding for constants.
Insight Class: SlevomatCodingStandard\Sniffs\Classes\DisallowLateStaticBindingForConstantsSniff
^1.0 Code\Classes
Modern ClassName referenceThis sniff reports use of __CLASS__
, get_parent_class()
, get_called_class()
, get_class()
and get_class($this)
. Class names should be referenced via ::class
constant when possible.
Insight Class: SlevomatCodingStandard\Sniffs\Classes\ModernClassNameReferenceSniff
^1.0 Code\Classes
Useless Late Static BindingThis sniff reports useless late static binding.
Insight Class: SlevomatCodingStandard\Sniffs\Classes\UselessLateStaticBindingSniff
^1.10 Code\Classes
Protected to privateThis fixer converts protected
variables and methods to private
where possible.
Insight Class: PhpCsFixer\Fixer\ClassNotation\ProtectedToPrivateFixer
^1.0 Code\Code
Unused variableThis sniff detects unused variables.
Insight Class: SlevomatCodingStandard\Sniffs\Variables\UnusedVariableSniff
^1.0 Code\Code
Code AnalyzerThis sniff runs the Zend Code Analyzer (from Zend Studio) on files.
Insight Class: PHP_CodeSniffer\Standards\Zend\Sniffs\Debug\CodeAnalyzerSniff
^1.0 Code\Code
Switch declarationThis sniff ensures all switch statements are defined correctly.
Insight Class: PHP_CodeSniffer\Standards\PSR2\Sniffs\ControlStructures\SwitchDeclarationSniff
^1.0 Code\Code
Language Construct spacingThis sniff ensures all language constructs contain a single space between themselves and their content
Insight Class: PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\LanguageConstructSpacingSniff
>=1.0 <2.0 Code\Code configurable
Element name minimal lengthInsight Class: ObjectCalisthenics\Sniffs\NamingConventions\ElementNameMinimalLengthSniff
Configuration
\ObjectCalisthenics\Sniffs\NamingConventions\ElementNameMinimalLengthSniff::class => [
'minLength' => 3,
'allowedShortNames' => ['i', 'id', 'to', 'up'],
]
>=1.0 <2.0 Code\Code configurable
Max nesting levelInsight Class: ObjectCalisthenics\Sniffs\Metrics\MaxNestingLevelSniff
Configuration
\ObjectCalisthenics\Sniffs\Metrics\MaxNestingLevelSniff::class => [
'maxNestingLevel' => 2,
]
^1.0 Code\Code
Useless VariableInsight Class: SlevomatCodingStandard\Sniffs\Variables\UselessVariableSniff
^1.0 Code\Code
EvalThis sniff detects usage of the eval()
function.
Insight Class: PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\EvalSniff
^1.0 Code\Code configurable
Array indentThis sniff ensures arrays are correctly indented
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Arrays\ArrayIndentSniff
Configuration
\PHP_CodeSniffer\Standards\Generic\Sniffs\Arrays\ArrayIndentSniff::class => [
'indent' => 4,
]
^1.0 Code\Code
Empty PHP statementChecks against empty PHP statements.
- Checks against two semi-colons with no executable code in between.
- Checks against an empty PHP open - close tag combination.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\EmptyPHPStatementSniff
^1.0 Code\Code
Empty StatementThis sniff detects empty statement.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\EmptyStatementSniff
^1.0 Code\Code
For loop should be While loopThis sniff detects for-loops that can be simplified to a while-loop
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\ForLoopShouldBeWhileLoopSniff
^1.0 Code\Code
For loop with test function callThis sniff detects for-loops that use a function call in the test expression.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\ForLoopWithTestFunctionCallSniff
^1.0 Code\Code
Jumbled IncrementerThis sniff detects the usage of one and the same incrementer into an outer and an inner loop. Even it is intended this is confusing code.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\JumbledIncrementerSniff
^1.0 Code\Code
Unconditional If statementThis sniff detects statement conditions that are only set to one of the constant values true or false
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\UnconditionalIfStatementSniff
^1.0 Code\Code
Useless Overriding MethodThis sniff detects the use of methods that only call their parent class's method with the same name and arguments. These methods are not required.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\UselessOverridingMethodSniff
^1.0 Code\Code
Inline control structureThis sniff verifies that inline control statements are not present.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\ControlStructures\InlineControlStructureSniff
^1.0 Code\Code
Disallow multiple statementsThis sniff ensures each statement is on a line by itself.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\DisallowMultipleStatementsSniff
^1.0 Code\Code
Backtick OperatorThis sniff disallows the use of the backtick execution operator.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\BacktickOperatorSniff
^1.0 Code\Code
Discourage GOTOThis sniff discourages the use of the PHP goto
language construct.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\DiscourageGotoSniff
^1.0 Code\Code
No silenced errorsThis sniff detects when any code prefixed with an ampersand is encountered.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\NoSilencedErrorsSniff
^1.0 Code\Code
Unnecessary string concatThis sniff checks that two strings are not concatenated together; suggests using one string instead.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Strings\UnnecessaryStringConcatSniff
^1.0 Code\Code
Short form type keywordsThis sniff verifies that the short form of type keywords is used (e.g., int, bool).
Insight Class: PHP_CodeSniffer\Standards\PSR12\Sniffs\Keywords\ShortFormTypeKeywordsSniff
^1.0 Code\Code
Disallow implicit array creationThis sniff disallows implicit array creation.
Insight Class: SlevomatCodingStandard\Sniffs\Arrays\DisallowImplicitArrayCreationSniff
^1.0 Code\Code
Assignment in conditionThis sniff disallows assignments in conditions.
Insight Class: SlevomatCodingStandard\Sniffs\ControlStructures\AssignmentInConditionSniff
^1.0 Code\Code
Disallow continue without integer operand in switchThis sniff disallows the use of continue
without an integer operand in a switch because it emits a warning in PHP 7.3 and higher.
Insight Class: SlevomatCodingStandard\Sniffs\ControlStructures\DisallowContinueWithoutIntegerOperandInSwitchSniff
^1.0 Code\Code
Disallow emptyThis sniff disallows use of empty()
.
Insight Class: SlevomatCodingStandard\Sniffs\ControlStructures\DisallowEmptySniff
^1.0 Code\Code
Disallow short ternary operatorThis sniff disallows the short ternary operator ?:
.
Insight Class: SlevomatCodingStandard\Sniffs\ControlStructures\DisallowShortTernaryOperatorSniff
^1.0 Code\Code
Disallow Yoda ComparisonYoda conditions decrease code comprehensibility and readability by switching operands around comparison operators forcing the reader to read the code in an unnatural way.
Insight Class: SlevomatCodingStandard\Sniffs\ControlStructures\DisallowYodaComparisonSniff
^1.0 not enabled
Require Yoda ComparisonThis sniff enforces yoda comparison usage.
Insight Class: SlevomatCodingStandard\Sniffs\ControlStructures\RequireYodaComparisonSniff
^1.0 Code\Code
Language Construct With ParenthesesInsight Class: SlevomatCodingStandard\Sniffs\ControlStructures\LanguageConstructWithParenthesesSniff
^1.0 Code\Code
Dead catchThis sniff finds unreachable catch blocks.
Insight Class: SlevomatCodingStandard\Sniffs\Exceptions\DeadCatchSniff
Example
try {
doStuff();
} catch (\Throwable $e) {
log($e);
} catch (\InvalidArgumentException $e) {
// unreachable!
}
^1.0 Code\Code Code\Functions
Unused Inherited variable passed to closureThis sniff looks for unused inherited variables passed to closures via use
.
Insight Class: SlevomatCodingStandard\Sniffs\Functions\UnusedInheritedVariablePassedToClosureSniff
^1.0 Code\Code
Useless Parameter default valueThis sniff looks for useless parameter default value.
Insight Class: SlevomatCodingStandard\Sniffs\Functions\UselessParameterDefaultValueSniff
^1.0 Code\Code
Use from same namespaceThis sniff prohibits uses from the same namespace.
Insight Class: SlevomatCodingStandard\Sniffs\Namespaces\UseFromSameNamespaceSniff
^1.0 Code\Code
Useless AliasThis sniff looks for use alias that is the same as the unqualified name.
Insight Class: SlevomatCodingStandard\Sniffs\Namespaces\UselessAliasSniff
^1.0 Code\Code
Disallow equal operatorsThis sniff disallows using loose ==
and !=
comparison operators.
Use ===
and !==
instead, they are much more secure and predictable.
Insight Class: SlevomatCodingStandard\Sniffs\Operators\DisallowEqualOperatorsSniff
^1.0 Code\Code
Require combined assignment operatorThis sniff requires using combined assignment operators, eg +=
, .=
etc.
Insight Class: SlevomatCodingStandard\Sniffs\Operators\RequireCombinedAssignmentOperatorSniff
^1.0 Code\Code
Require only standalone increment and decrement operatorsThis sniff reports ++
and --
operators not used standalone.
Insight Class: SlevomatCodingStandard\Sniffs\Operators\RequireOnlyStandaloneIncrementAndDecrementOperatorsSniff
^1.0 Code\Code
Optimized functions without unpackingPHP optimizes some internal functions into special opcodes on VM level. Such optimization results in much faster execution compared to calling standard function. This only works when these functions are not invoked with argument unpacking (...).
The list of these functions varies across PHP versions, but is the same as functions that must be referenced by their global name (either by \
prefix or using use function
), not a fallback name inside namespaced code.
Insight Class: SlevomatCodingStandard\Sniffs\PHP\OptimizedFunctionsWithoutUnpackingSniff
^1.0 Code\Code
Type castThis sniff enforces using shorthand cast operators, forbids use of unset and binary cast operators.
Insight Class: SlevomatCodingStandard\Sniffs\PHP\TypeCastSniff
^1.0 Code\Code
Useless parenthesesThis sniff looks for useless parentheses.
Insight Class: SlevomatCodingStandard\Sniffs\PHP\UselessParenthesesSniff
^1.0 Code\Code
Useless semicolonThis sniff looks for useless semicolons.
Insight Class: SlevomatCodingStandard\Sniffs\PHP\UselessSemicolonSniff
^1.0 Code\Code
Declare strict typesThis sniff enforces having declare(strict_types = 1)
at the top of each PHP file.
Insight Class: SlevomatCodingStandard\Sniffs\TypeHints\DeclareStrictTypesSniff
^1.0 Code\Code
Duplicate assignment to variableThis sniff looks for duplicate assignments to a variable.
Insight Class: SlevomatCodingStandard\Sniffs\Variables\DuplicateAssignmentToVariableSniff
^1.0 Code\Comments
Nullable type for null default valueThis sniff checks whether the nullability ?
symbol is present before each nullable and optional parameter (which are marked as = null
)
Insight Class: SlevomatCodingStandard\Sniffs\TypeHints\NullableTypeForNullDefaultValueSniff
Example
function foo(
int $foo = null, // ? missing
?int $bar = null // correct
) {
// ...
}
^1.10 Architecture\Functions
Void returnThis 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
^1.0 Code\Comments
FixmeThis sniff warns about FIXME comments.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting\FixmeSniff
^1.0 Code\Comments
TodoThis sniff warns about TODO comments.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting\TodoSniff
^1.0 Code\Comments configurable
Forbidden commentsThis sniff reports forbidden comments in descriptions. Nothing is forbidden by default, the configuration is completely up to the user. It's recommended to forbid generated or inappropriate messages like:
Constructor.
Created by PhpStorm.
Insight Class: SlevomatCodingStandard\Sniffs\Commenting\ForbiddenCommentsSniff
Configuration
SlevomatCodingStandard\Sniffs\Commenting\ForbiddenCommentsSniff::class => [
'forbiddenCommentPatterns' => []
]
^1.0 Code\Comments
Inline doc comment declarationThis sniff reports invalid inline phpDocs with @var
.
Insight Class: SlevomatCodingStandard\Sniffs\Commenting\InlineDocCommentDeclarationSniff
^1.12 Code\Comments
Useless Function doc commentThis sniff disallows useless doc comments. If the native method declaration contains everything and the phpDoc does not add anything useful, it's reported as useless.
Some type hints can be enforced to be specified with a contained type, with traversableTypeHints
. See the official explanation
Insight Class: SlevomatCodingStandard\Sniffs\Commenting\UselessFunctionDocCommentSniff
Configuration
SlevomatCodingStandard\Sniffs\Commenting\UselessFunctionDocCommentSniff::class => [
'traversableTypeHints' => []
]
^1.0 Code\Comments
Disallow Array type hint syntaxThis sniff disallows usage of array type hint syntax (eg. int[]
, bool[][]
) in phpDocs in favour of generic type hint syntax (eg. array<int>
, array<array<bool>>
).
Insight Class: SlevomatCodingStandard\Sniffs\TypeHints\DisallowArrayTypeHintSyntaxSniff
^1.0 Code\Comments
Disallow mixed type hintThis sniff disallows usage of the "mixed" type hint in phpDocs.
Insight Class: SlevomatCodingStandard\Sniffs\TypeHints\DisallowMixedTypeHintSniff
^1.0 Code\Comments
Long type hintsThis sniff enforces using shorthand scalar type hint variants in phpDocs: int
instead of integer
and bool
instead of boolean
.
This is for consistency with native scalar type hints which also allow shorthand variants only.
Insight Class: SlevomatCodingStandard\Sniffs\TypeHints\LongTypeHintsSniff
^1.0 Code\Comments
Null type hint on last positionThis sniff enforces null
type hint on last position in annotations.
Insight Class: SlevomatCodingStandard\Sniffs\TypeHints\NullTypeHintOnLastPositionSniff
>=1.0 <1.12 Code\Comments
Type hint declarationSee the official explanation
Insight Class: SlevomatCodingStandard\Sniffs\TypeHints\TypeHintDeclarationSniff
^1.12 Code\Comments
Parameter Type hintSee the official explanation
Insight Class: SlevomatCodingStandard\Sniffs\TypeHints\ParameterTypeHintSniff
^1.12 Code\Comments
Property Type hintSee the official explanation
Insight Class: SlevomatCodingStandard\Sniffs\TypeHints\PropertyTypeHintSniff
^1.12 Code\Comments
Return Type hintSee the official explanation
Insight Class: SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff
^1.0 Code\Comments
Useless constant type hintThis sniff reports useless @var
annotation (or whole documentation comment) for constants because the type of the constant is always clear.
Insight Class: SlevomatCodingStandard\Sniffs\TypeHints\UselessConstantTypeHintSniff
^1.0 Code\Comments
Useless Inherit doc commentThis sniff reports documentation comments containing only {@inheritDoc}
annotation because inheritance is automatic and it's not needed to use a special annotation for it.
Insight Class: SlevomatCodingStandard\Sniffs\Commenting\UselessInheritDocCommentSniff
^1.0 Code\Functions
Unused parameterThis sniff looks for unused parameters.
Insight Class: SlevomatCodingStandard\Sniffs\Functions\UnusedParameterSniff
^1.0 Code\Functions
Call time pass by referenceThis sniff ensures that variables are not passed by reference when calling a function.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Functions\CallTimePassByReferenceSniff
^1.0 Code\Functions
Deprecated functionsThis sniff discourages the use of deprecated PHP functions.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\DeprecatedFunctionsSniff
^1.0 Code\Functions
Nullable type declarationThis sniff verifies that nullable type hints are lacking superfluous whitespace (e.g. ?int
).
Insight Class: PHP_CodeSniffer\Standards\PSR12\Sniffs\Functions\NullableTypeDeclarationSniff
^1.0 Code\Functions
Static closureThis sniff reports closures not using $this
that are not declared static.
Insight Class: SlevomatCodingStandard\Sniffs\Functions\StaticClosureSniff
^1.0 Code\Functions
Forbidden define functionsThis insight disallows define functions.
Insight Class: NunoMaduro\PhpInsights\Domain\Insights\ForbiddenDefineFunctions
^1.0 Code\Functions
Forbidden functionsThis sniff discourages the use of alias functions.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff
^1.0 Code\Globally
Global KeywordThis sniff disallow usage of global
.
Insight Class: PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\GlobalKeywordSniff
^1.0 Code\Globally
Forbidden GlobalsThis sniff detects globals accesses.
Insight Class: NunoMaduro\PhpInsights\Domain\Insights\ForbiddenGlobals
^1.10 Code\Classes configurable
Visibility RequiredVisibility must be declared on all properties and methods. abstract
and final
must be declared before the visibility. static
must be declared after the visibility.
Insight Class: PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer
Configuration
\PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer::class => [
'elements' => [
'property',
'method',
],
]
^1.10 Code\Code
Ternary to Null CoalescingThis fixer enforces using the null coalescing operator ??
where possible.
Insight Class: PhpCsFixer\Fixer\Operator\TernaryToNullCoalescingFixer
^1.10 Code\Code
Combine nested dirnameThis fixer replaces multiple nested calls of dirname
with only one call with second $level
parameter.
Insight Class: PhpCsFixer\Fixer\FunctionNotation\CombineNestedDirnameFixer
^1.10 Code\Code configurable
Declare Equal normalizeThis fixer normalizes space around the equal sign in declare section.
Insight Class: PhpCsFixer\Fixer\LanguageConstruct\DeclareEqualNormalizeFixer
Configuration
\PhpCsFixer\Fixer\LanguageConstruct\DeclareEqualNormalizeFixer::class => [
'space' => 'none', // possible values ['none', 'single']
]
^1.10 Code\Code
Explicit string variableThis fixer converts implicit variables into explicit ones in double-quoted strings or heredoc syntax.
Insight Class: PhpCsFixer\Fixer\StringNotation\ExplicitStringVariableFixer
^1.10 Code\Code
New with bracesThis fixer asserts all instances created with new keyword must be followed by braces.
Insight Class: PhpCsFixer\Fixer\Operator\NewWithBracesFixer
^1.10 Code\Code
No alternative syntaxThis fixer replaces control structure alternative syntax to use braces.
Insight Class: PhpCsFixer\Fixer\ControlStructure\NoAlternativeSyntaxFixer
^1.10 Code\Code configurable
No mixed echo printThis fixer enforces either language construct print or echo should be used.
Insight Class: PhpCsFixer\Fixer\Alias\NoMixedEchoPrintFixer
Configuration
\PhpCsFixer\Fixer\Alias\NoMixedEchoPrintFixer::class => [
'use' => 'echo' // possibles values ['echo', 'print']
]
^1.10 Code\Code
No multiline whitespace around double arrowThe Operator =>
should not be surrounded by multi-line whitespaces.
Insight Class: PhpCsFixer\Fixer\ArrayNotation\NoMultilineWhitespaceAroundDoubleArrowFixer
^1.10 Code\Code
No short bool castThis fixer asserts short cast bool using double exclamation marks should not be used.
Insight Class: PhpCsFixer\Fixer\CastNotation\NoShortBoolCastFixer
^1.10 Code\Code
No superfluous ElseifThis fixer replaces superfluous elseif
with if
.
Insight Class: PhpCsFixer\Fixer\ControlStructure\NoSuperfluousElseifFixer
^1.10 Code\Code configurable
No unneeded control parenthesesThis fixer removes unneeded parentheses around control statements.
Insight Class: PhpCsFixer\Fixer\ControlStructure\NoUnneededControlParenthesesFixer
Configuration
\PhpCsFixer\Fixer\ControlStructure\NoUnneededControlParenthesesFixer::class => [
'statements' => [
'break',
'clone',
'continue',
'echo_print',
'return',
'switch_case',
'yield',
],
]
^1.10 Code\Code
No useless ElseThis fixer assert there should not be useless else
cases.
Insight Class: PhpCsFixer\Fixer\ControlStructure\NoUselessElseFixer
^1.10 Code\Code
Normalize index braceArray index should always be written by using square braces.
Insight Class: PhpCsFixer\Fixer\ArrayNotation\NormalizeIndexBraceFixer
^1.10 Code\Code
Object operator without WhitespaceThere should not be space before or after object T_OBJECT_OPERATOR ->
.
Insight Class: PhpCsFixer\Fixer\Operator\ObjectOperatorWithoutWhitespaceFixer
^1.10 Code\Code
Short scalar castCast (boolean)
and (integer)
should be written as (bool)
and (int)
, (double)
and (real)
as (float)
, (binary)
as (string)
.
Insight Class: PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer
^1.10 Code\Code
Ternary operator spacesThis fixer standardizes spaces around ternary operators.
Insight Class: PhpCsFixer\Fixer\Operator\TernaryOperatorSpacesFixer
^1.10 Code\Comments
Multiline comment opening closingDocBlocks must start with two asterisks, multiline comments must start with a single asterisk, after the opening slash. Both must end with a single asterisk before the closing slash.
Insight Class: PhpCsFixer\Fixer\Comment\MultilineCommentOpeningClosingFixer
^1.10 Code\Comments
No empty commentThere should not be any empty comments.
Insight Class: PhpCsFixer\Fixer\Comment\NoEmptyCommentFixer
^1.10 Code\Comments configurable
No break commentThere must be a comment when fall-through is intentional in a non-empty case body.
Insight Class: PhpCsFixer\Fixer\ControlStructure\NoBreakCommentFixer
Configuration
\PhpCsFixer\Fixer\ControlStructure\NoBreakCommentFixer::class => [
'comment_text' => 'no break',
]
^1.10 Code\Comments configurable
Phpdoc scalarScalar types should always be written in the same form.
int
not integer
, bool
not boolean
, float
not real
or double
.
Insight Class: PhpCsFixer\Fixer\Phpdoc\PhpdocScalarFixer
Configuration
\PhpCsFixer\Fixer\Phpdoc\PhpdocScalarFixer::class => [
'types' => [
'boolean',
'double',
'integer',
'real',
'str',
]
]
^1.10 Code\Functions
No spaces after function nameWhen making a method or function call, there must not be a space between the method or function name and the opening parenthesis.
Insight Class: PhpCsFixer\Fixer\FunctionNotation\NoSpacesAfterFunctionNameFixer
^1.10 Code\Functions
Return assignmentLocal, dynamic and directly referenced variables should not be assigned and directly returned by a function or method.
Insight Class: PhpCsFixer\Fixer\ReturnNotation\ReturnAssignmentFixer