Repository navigation
coding-standard 1.1.0
Added
-
#35 adds
PHP\StaticCallbacksniff which detects closures and check if these can be marked as static -
#36 adds
PHP\DisallowCurlyOffsetAccessBracesniff which detects array and string offset access using curly brackets.
This functionality is deprecated as of PHP 7.4 so sniff can be useful when providing compatibility with PHP 7.4. -
#38 adds
ControlStructures\RedundantCasesniff which detects redundant cases within a switch control structure -
#41 adds
ControlStructures\DefaultAsLastsniff which requiresdefaultcase to be last case in a switch control structure -
#39 adds
Arrays\DuplicateKeysniff which detects duplicated keys in arrays -
#42 adds requiring camelCase names for class members and variables used in strings - extended sniff
NamingConventions\ValidVariableName.
Disallowed are two capital letters next to each other (strict mode). -
#60 extends
Classes\TraitUsagesniff to check if traits declarations are on the top of the class.
Traits must be specified before constants, properties and methods. -
#45 adds
Classes\ConstBeforePropertysniff to require constant definitions in classes and interfaces before properties and methods -
#46 adds
Classes\PropertyBeforeMethodsniff to require property definitions in classes before methods -
#47 adds
Commenting\TagNamesniff which checks if PHPDoc tags have additional characters at the end of the name.
By default:and;are disallowed and removed by fixer, but the list of disallowed characters can be configured by optiondisallowedEndChars -
#48 adds configuration option
nullPositiontoCommenting\TagWithTypesniff. Default value isfirstto keep backward compatibility.
The other allowed value islastso thennullvalues in type list is at the last position. -
#49 adds
Commenting\DisallowEmptyCommentsniff to detect empty comments and multiple empty lines in comments -
#50 adds check for open and close of doc block comment in
Commenting\DocComment.
Only short version is allowed:/**and*/. Additional asterisk are disallowed. -
#51 adds check for blank lines and comments before arrow in arrays in
Array\Formatsniff.
Arrow must be after the index value, can be in new line, but any additional lines or comments are disallowed. -
#54 adds
Namespaces\UniqueImportsniff to detect if class/function/constant is imported only once.
Sniff checks also if the name is used only once. The same name can be used for class/function/constant, and constant names are case sensitive. -
#37 adds additional sniffs to
WebimpressCodingStandardruleset:Generic.ControlStructures.DisallowYodaConditions,Squiz.Operators.IncrementDecrementUsage,Squiz.PHP.DisallowMultipleAssignments(withSquiz.PHP.DisallowMultipleAssignments.FoundInControlStructureexclusion).
-
#59 extends
Commenting\DocCommentsniff to check if every line of DocBlock comment starts with* -
#53 adds support for use groups in
Namespaces\UnusedUseStatementsniff -
#58 adds property type declaration (PHP 7.4+). The following sniffs are affected:
Commenting\PropertyAnnotation- ensure that type is skipped when detecting the comment before property,Commenting\VariableComment- add multiple checks to ensure type declaration is consistent with type provided in PHPDoc (@vartag). In case type declaration is provided and PHPDoc does not contain any additional information,@vartag can be omitted.
-
#62 adds support for
Iteratortype inFunctions\ParamandFunctions\ReturnTypesniffs -
#62 adds check for return type of function with
yield. Generators may only declare a return type ofGenerator,Iterator,Traversableoriterable. -
#63 adds ability to align array arrows when in new line. To use it, there is an example configuration:
// configuration of double arrow alignment WebimpressCodingStandard.Arrays.DoubleArrow.maxPadding = 50 WebimpressCodingStandard.Arrays.DoubleArrow.ignoreNewLineArrayArrow = false // ignore indent or double arrow when at the beginning of the line WebimpressCodingStandard.WhiteSpace.ScopeIndent.ignoreNewLineArrayArrow = true // ignore spacing before double arrow (so we can have more than one space) WebimpressCodingStandard.WhiteSpace.OperatorAndKeywordSpacing.ignoreSpacingBeforeAssignments = true -
#67 adds support for PHP 7.4 arrow functions.
Changed
-
#42 changes
NamingConventions\ValidVariableNameto require variable names be in strict camelCase. It means two capital letters next to each other are not allowed. -
#44 changes
PSR1.Methods.CamelCapsMethodNamewithGeneric.NamingConventions.CamelCapsFunctionNameso from now method names must be in strict camelCas. It means two capital letters next to each other are not allowed. -
#37 updates the
squizlabs/php_codesnifferdependency to^3.5.2 -
#61 replaces
Squiz.WhiteSpace.OperatorSpacingwithWebimpressCodingStandard.WhiteSpace.OperatorAndKeywordSpacingsniff.
This sniff still extendsSquiz.WhiteSpace.OperatorSpacingbut check additional tokens:asandinsteadofand Logical Operators.
It also disallows mor then one empty line before operators, and foras,insteadof, andinstanceofrequires single space before and after.
Deprecated
- Nothing.
Removed
- #42 excludes
PSR2.Classes.PropertyDeclaration.Underscorecheck, as it is now covered byNamingConventions\ValidVariableNamesniff