phpcsstandards/phpcsextra
A collection of sniffs and standards for use with PHP_CodeSniffer.
1.5.1
34M downloads/mo
#436 most downloaded on Packagist
PHPCSStandards/PHPCSExtra
What this package is like to depend on
Last release 27 days ago
27 Jul 2026
Ships unpredictably
gaps range from 2 weeks to 1.4 years
Nearly every release is documented
notes for 17 of 17 stable releases
Nothing withdrawn
no release was ever pulled
7 years old
21 releases · first in 2020
4 releases in the last 12 months
see the full history below
Release timeline
21 releases · Jan 2020 to Jul 2026Releases
latest 21-
1.5.127 Jul 2026Release notes
Open source →Changed
Other
- Composer: The minimum
PHPCSUtilsrequirement has been updated to1.2.3(was1.2.0). #464 - Various housekeeping. Including a contribution by @rodrigoprimo.
Release notes
Open source →Changed
Other
- Composer: The minimum
PHPCSUtilsrequirement has been updated to1.2.3(was1.2.0). #464 - Various housekeeping. Including a contribution by [@rodrigoprimo].
- Composer: The minimum
-
1.5.012 Nov 2025Release notes
Open source →Added
Universal
- 🔧 📊 📚 New
Universal.Attributes.BracketSpacingsniff to enforce a fixed number of spaces on the inside of attribute block brackets. #386, #406
The sniff offers the following properties to influence its behaviour:spacing(defaults to0).ignoreNewlines(defaults tofalse).
When new lines are allowed (ignoreNewlines=true) and a new line is found, the sniff will verify that there are no superfluous blank lines at the start/end of an attribute block.
- 🔧 📊 📚 New
Universal.Attributes.DisallowAttributeParenthesessniff to forbid parentheses for attribute instantiations without arguments. #387, #409 - 🔧 📊 📚 New
Universal.Attributes.RequireAttributeParenthesessniff to demand that all attribute instantiations always use parentheses, even if no argument is passed. #387, #410 - 🔧 📊 📚 New
Universal.Attributes.TrailingCommasniff to demand a trailing comma for multi-line, multi-attribute attribute blocks and forbid trailing commas in single-line attribute blocks and in multi-line attributes containing only a single attribute. #397, #413 - 🔧 📊 📚 New
Universal.PHP.DisallowExitDieParenthesessniff to forbid invocations ofexit/diewith parentheses when no argument is passed. #399 - 🔧 📊 📚 New
Universal.PHP.RequireExitDieParenthesessniff to demand that invocations ofexit/diealways use parentheses, even if no argument is passed. #398 - 🔧 📚 New
Universal.WhiteSpace.FirstClassCallableSpacingsniff to enforce consistent spacing around the ellipses for first class callables. #385
The sniff offers the following property to influence its behaviour:spacing(defaults to0).
Changed
Universal
Universal.WhiteSpace.CommaSpacing: improved handling of commas in PHP attributes. #391, #412- The spacing after a trailing comma (after the last attribute in a block) will no longer be checked to prevent potential conflicts with attribute bracket spacing sniffs.
- Spacing errors for commas between attributes in an attribute block will now get an
*InAttributeBlockerror code suffix, so in-/excluding them selectively is more straight-forward.
Note: spacing around commas between parameters passed to an attribute will still be reported with the*InFunctionCallerror code suffix, same as before. - Metrics for comma spacing in attribute blocks is now also measured and reported separately.
Other
Release notes
Open source →Added
Universal
- :wrench: :bar_chart: :books: New
Universal.Attributes.BracketSpacingsniff to enforce a fixed number of spaces on the inside of attribute block brackets. #386, #406 The sniff offers the following properties to influence its behaviour:spacing(defaults to0).ignoreNewlines(defaults tofalse). When new lines are allowed (ignoreNewlines=true) and a new line is found, the sniff will verify that there are no superfluous blank lines at the start/end of an attribute block.
- :wrench: :bar_chart: :books: New
Universal.Attributes.DisallowAttributeParenthesessniff to forbid parentheses for attribute instantiations without arguments. #387, #409 - :wrench: :bar_chart: :books: New
Universal.Attributes.RequireAttributeParenthesessniff to demand that all attribute instantiations always use parentheses, even if no argument is passed. #387, #410 - :wrench: :bar_chart: :books: New
Universal.Attributes.TrailingCommasniff to demand a trailing comma for multi-line, multi-attribute attribute blocks and forbid trailing commas in single-line attribute blocks and in multi-line attributes containing only a single attribute. #397, #413 - :wrench: :bar_chart: :books: New
Universal.PHP.DisallowExitDieParenthesessniff to forbid invocations ofexit/diewith parentheses when no argument is passed. #399 - :wrench: :bar_chart: :books: New
Universal.PHP.RequireExitDieParenthesessniff to demand that invocations ofexit/diealways use parentheses, even if no argument is passed. #398 - :wrench: :books: New
Universal.WhiteSpace.FirstClassCallableSpacingsniff to enforce consistent spacing around the ellipses for first class callables. #385 The sniff offers the following property to influence its behaviour:spacing(defaults to0).
Changed
Universal
Universal.WhiteSpace.CommaSpacing: improved handling of commas in PHP attributes. #391, #412- The spacing after a trailing comma (after the last attribute in a block) will no longer be checked to prevent potential conflicts with attribute bracket spacing sniffs.
- Spacing errors for commas between attributes in an attribute block will now get an
*InAttributeBlockerror code suffix, so in-/excluding them selectively is more straight-forward. Note: spacing around commas between parameters passed to an attribute will still be reported with the*InFunctionCallerror code suffix, same as before. - Metrics for comma spacing in attribute blocks is now also measured and reported separately.
Other
- 🔧 📊 📚 New
-
1.4.228 Oct 2025Release notes
Open source →Changed
Other
- Various housekeeping.
Fixed
Universal
Universal.OOStructures.AlphabeticExtendsImplementsincorrectly displayed the "expected" and "found" names. #378Universal.WhiteSpace.CommaSpacingcould accidentally cause a fatal error if the content adjacent to the comma was a text string containing percentage signs. Thanks @westonruter for reporting! #400, #401
Release notes
Open source →Changed
Other
- Various housekeeping.
Fixed
Universal
Universal.OOStructures.AlphabeticExtendsImplementsincorrectly displayed the "expected" and "found" names. #378Universal.WhiteSpace.CommaSpacingcould accidentally cause a fatal error if the content adjacent to the comma was a text string containing percentage signs. Thanks [@westonruter] for reporting! #400, #401
-
1.4.105 Sep 2025Release notes
Open source →Changed
Other
- Various housekeeping.
Fixed
Universal
Universal.PHP.NoFQNTrueFalseNull: fix breakage due to upstream change in tokenization. #375
Release notes
Open source →Changed
Other
- Various housekeeping.
Fixed
Universal
Universal.PHP.NoFQNTrueFalseNull: fix breakage due to upstream change in tokenization. #375
-
1.4.014 Jun 2025Release notes
Open source →Added
- All sniffs: compatibility with the new PHP_CodeSniffer
4.xbranch in anticipation of the PHP_CodeSniffer 4.0 release. #367
PHPCSExtra should now be fully compatible with PHP_CodeSniffer 4.0. If you still find an issue, please report it.
Changed
Other
- Composer: The minimum
PHP_CodeSnifferrequirement has been updated to^3.13.0(was^3.12.1). #361 - Composer: The minimum
PHPCSUtilsrequirement has been updated to^1.1.0(was^1.0.12). #361 - Various housekeeping.
Deprecated
Universal
Universal.WhiteSpace.PrecisionAlignment: support for scanning JS/CSS files via this sniff is now deprecated. #367
Fixed
Universal
Universal.Arrays.DuplicateArrayKey: false positives for numeric strings with leading/trailing underscores. Fixed via the update to PHPCSUtils 1.1.0. #363Universal.Arrays.DuplicateArrayKey: false negatives for fully qualifiedtrue/false/nullarrays keys. Fixed via the update to PHPCSUtils 1.1.0. #363Universal.WhiteSpace.CommaSpacing: wrong errorcode for comma's in closure use statements after the update to PHPCSUtils 1.1.0. #362
Release notes
Open source →Added
- All sniffs: compatibility with the new PHP_CodeSniffer
4.xbranch in anticipation of the PHP_CodeSniffer 4.0 release. #367 PHPCSExtra should now be fully compatible with PHP_CodeSniffer 4.0. If you still find an issue, please report it.
Changed
Other
- Composer: The minimum
PHP_CodeSnifferrequirement has been updated to^3.13.0(was^3.12.1). #361 - Composer: The minimum
PHPCSUtilsrequirement has been updated to^1.1.0(was^1.0.12). #361 - Various housekeeping.
Deprecated
Universal
Universal.WhiteSpace.PrecisionAlignment: support for scanning JS/CSS files via this sniff is now deprecated. #367
Fixed
Universal
Universal.Arrays.DuplicateArrayKey: false positives for numeric strings with leading/trailing underscores. Fixed via the update to PHPCSUtils 1.1.0. #363Universal.Arrays.DuplicateArrayKey: false negatives for fully qualifiedtrue/false/nullarrays keys. Fixed via the update to PHPCSUtils 1.1.0. #363Universal.WhiteSpace.CommaSpacing: wrong errorcode for comma's in closure use statements after the update to PHPCSUtils 1.1.0. #362
- All sniffs: compatibility with the new PHP_CodeSniffer
-
1.3.108 Jun 2025Release notes
Open source →Changed
Other
- Composer: The minimum
PHPCSUtilsrequirement has been updated to^1.0.12(was^1.0.9). #346 - Various housekeeping.
Fixed
Universal
Universal.UseStatements.DisallowMixedGroupUse: the fixer could get confused when the "base" name for the group name contained a leading backslash, leading to parse errors in the fixed code. #350
Release notes
Open source →Changed
Other
- Composer: The minimum
PHPCSUtilsrequirement has been updated to^1.0.12(was^1.0.9). #346 - Various housekeeping.
Fixed
Universal
Universal.UseStatements.DisallowMixedGroupUse: the fixer could get confused when the "base" name for the group name contained a leading backslash, leading to parse errors in the fixed code. #350
- Composer: The minimum
-
1.3.020 Apr 2025Release notes
Open source →Added
Universal
- 🔧 📚 New
Universal.PHP.NoFQNTrueFalseNullsniff to forbid usingtrue,falseandnullas fully qualified constants. Thanks @rodrigoprimo for reviewing. #327 Universal.Operators.TypeSeparatorSpacing: support for checking the spacing around the parentheses used in PHP 8.2+ DNF types. #329
Changed
Universal
- The
Universal.WhiteSpace.DisallowInlineTabssniff will now also check for inline tabs in heredoc/nowdoc openers and between theyieldandfromkeywords. #320
Other
Release notes
Open source →Added
Universal
- :wrench: :books: New
Universal.PHP.NoFQNTrueFalseNullsniff to forbid usingtrue,falseandnullas fully qualified constants. Thanks [@rodrigoprimo] for reviewing. #327 Universal.Operators.TypeSeparatorSpacing: support for checking the spacing around the parentheses used in PHP 8.2+ DNF types. #329
Changed
Universal
- The
Universal.WhiteSpace.DisallowInlineTabssniff will now also check for inline tabs in heredoc/nowdoc openers and between theyieldandfromkeywords. #320
Other
- 🔧 📚 New
-
1.2.108 Dec 2023Release notes
Open source →Changed
Other
- Composer: The minimum
PHP_CodeSnifferrequirement has been updated to^3.8.0(was^3.7.2). #298 - Composer: The minimum
PHPCSUtilsrequirement has been updated to^1.0.9(was^1.0.8). #298
Please ensure you run
composer update phpcsstandards/phpcsextra --with-dependenciesto benefit from this.Release notes
Open source →Changed
Other
- Composer: The minimum
PHP_CodeSnifferrequirement has been updated to^3.8.0(was^3.7.2). #298 - Composer: The minimum
PHPCSUtilsrequirement has been updated to^1.0.9(was^1.0.8). #298
Please ensure you run
composer update phpcsstandards/phpcsextra --with-dependenciesto benefit from this. - Composer: The minimum
-
1.2.002 Dec 2023Release notes
Open source →Added
Universal
- 🔧 📚 New
Universal.CodeAnalysis.NoDoubleNegativesniff to detect double negatives (!!) and advise to use a boolean cast instead. Thanks @diedexx for reviewing. #277 - 🔧 📚 New
Universal.Operators.ConcatPositionsniff to enforce that the concatenation operator for multi-line concatenations is in a preferred position, either always at the start of the next line or always at the end of the previous line. #294 - 🔧 📊 📚 New
Universal.PHP.LowercasePHPTagsniff to enforce that the "PHP" in a PHP open tag is lowercase. Thanks @fredden for reviewing. #276
Changed
NormalizedArrays
NormalizedArrays.Arrays.CommaAfterLast: the sniff now has two extra error codes to distinguish between multi-line arrays with the last array item on the same line as the array closer vs the last array item being on a line before the array closer. Thanks @stronk7 for suggesting and patching this. #283, #284
These new error codes allow for selectively excluding that specific situation from triggering the sniff.
The new error codes areFoundMultiLineCloserSameLine(formultiLine="forbid") andMissingMultiLineCloserSameLine(formultiLine="enforce").
The pre-existingFoundMultiLineandFoundSingleLineerror codes continue to be used for multi-line arrays with the last array item on a different line than the array closer.
Other
- Various housekeeping.
Release notes
Open source →Added
Universal
- :wrench: :books: New
Universal.CodeAnalysis.NoDoubleNegativesniff to detect double negatives (!!) and advise to use a boolean cast instead. Thanks [@diedexx] for reviewing. #277 - :wrench: :books: New
Universal.Operators.ConcatPositionsniff to enforce that the concatenation operator for multi-line concatenations is in a preferred position, either always at the start of the next line or always at the end of the previous line. #294 - :wrench: :bar_chart: :books: New
Universal.PHP.LowercasePHPTagsniff to enforce that the "PHP" in a PHP open tag is lowercase. Thanks [@fredden] for reviewing. #276
Changed
NormalizedArrays
NormalizedArrays.Arrays.CommaAfterLast: the sniff now has two extra error codes to distinguish between multi-line arrays with the last array item on the same line as the array closer vs the last array item being on a line before the array closer. Thanks [@stronk7] for suggesting and patching this. #283, #284 These new error codes allow for selectively excluding that specific situation from triggering the sniff. The new error codes areFoundMultiLineCloserSameLine(formultiLine="forbid") andMissingMultiLineCloserSameLine(formultiLine="enforce"). The pre-existingFoundMultiLineandFoundSingleLineerror codes continue to be used for multi-line arrays with the last array item on a different line than the array closer.
Other
- Various housekeeping.
- 🔧 📚 New
-
1.1.220 Sep 2023Release notes
Open source →Changed
Other
- Various housekeeping.
Fixed
Universal
Universal.CodeAnalysis.ConstructorDestructorReturn: the sniff will now correctly ignore methods mirroring the class name (PHP-4 style constructors) in namespaced code. [#207], #272
-
1.1.126 Aug 2023Release notes
Open source →Changed
Modernize
Modernize.FunctionCalls.Dirname: the sniff will now respect a potentially set [php_versionconfiguration option][php_version-config] and only report on modernizations which are possible on the configuredphp_version. #261 If thephp_versionis not set, the sniff will continue to report on all modernization options.
Other
- Various documentation improvements. Props in part to [@szepeviktor].
- Improved defensive coding in select places.
- Various housekeeping.
-
1.1.019 Jul 2023Release notes
Open source →Added
Universal
- :wrench: :books: New
Universal.CodeAnalysis.NoEchoSprintfsniff to detect use of the inefficientecho [v]sprintf(...);combi and recommends using[v]printf()instead. #242 - :bar_chart: :books: New
Universal.FunctionDeclarations.NoLongClosuressniff to detect "long" closures and recommend using a named function instead. #240 The sniff offers the following properties to influence its behaviour:recommendedLines(defaults to5),maxLines(defaults to8),ignoreCommentLines(defaults totrue) andignoreEmptyLines(defaults totrue). - :wrench: :bar_chart: :books: New
Universal.FunctionDeclarations.RequireFinalMethodsInTraitssniff to enforce non-private, non-abstract methods in traits to be declared asfinal. #243, #245 There is a separateNonFinalMagicMethodFounderror code for magic methods to allow those to be excluded from the check. - :wrench: :bar_chart: :books: New
Universal.UseStatements.DisallowMixedGroupUsesniff to disallow group use statements which import a combination of namespace/OO construct, functions and/or constants in one statement. #241, #246 Note: the fixer will use a semi-standardized format for group use statements. If there are more specific requirements for the formatting of group use statements, the ruleset configurator should ensure that additional sniffs are included in the ruleset to enforce the required format. - :wrench: :bar_chart: :books: New
Universal.UseStatements.KeywordSpacingsniff to enforce the use of a single space after theuse,function,constkeywords and both before and after theaskeyword in importusestatements. #247 The sniff has modular error codes to allow for disabling individual checks. - :wrench: :books: New
Universal.UseStatements.NoUselessAliasessniff to detect useless aliases (aliasing something to its original name) in import use statements. #244 Note: as OO and function names in PHP are case-insensitive, aliasing to the same name, using a different case is also considered useless. - :wrench: :bar_chart: :books: New
Universal.WhiteSpace.CommaSpacingsniff to enforce that there is no space before a comma and exactly one space, or a new line, after a comma. #254 Additionally, the sniff also enforces that the comma should follow the code and not be placed after a trailing comment. The sniff has modular error codes to allow for disabling individual checks and checks in certain contexts. The sniff will respect a potentially set [php_versionconfiguration option][php_version-config] when deciding how to handle the spacing after a heredoc/nowdoc closer.
Changed
Universal
- Minor performance improvements for the
Universal.Arrays.DuplicateArrayKeyand theUniversal.CodeAnalysis.ConstructorDestructorReturnsniffs. #251, #252
Other
- :wrench: :books: New
-
1.0.417 Jun 2023Release notes
Open source →Changed
Other
- Composer: The minimum
PHPCSUtilsrequirement has been updated to^1.0.6(was^1.0.0). #237 - Various housekeeping.
Fixed
Universal
Universal.Constants.LowercaseClassResolutionKeyword: prevent false positives for function calls to methods calledclass. #226
- Composer: The minimum
-
1.0.328 Mar 2023 -
1.0.209 Jan 2023 -
1.0.105 Jan 2023 -
1.0.004 Jan 2023Release notes
Open source →:warning: Important: this package now requires PHPCSUtils 1.0.0. Please make sure you use
--with-[all-]dependencieswhen runningcomposer update. :exclamation:For the full list of features, please see the changelogs of the alpha/rc releases:
Changed
Other
- Updated various sniffs to take advantage of PHPCSUtils 1.0.0(-rc1). #193, #194, #195
- Minor documentation improvements.
- Various housekeeping.
Fixed
Modernize
Modernize.FunctionCalls.Dirname: the sniff will now correctly recognize magic constants in a case-insensitive manner. #187
-
1.0.0-rc107 Dec 2022 pre-releaseNothing published for this version
-
1.0.0-alpha329 Jun 2020 pre-releaseRelease notes
Open source →Added
Universal
- :wrench: :books: New
Universal.Arrays.DisallowShortArraySyntaxsniff to disallow short array syntax. #40 In contrast to the PHPCS nativeGeneric.Arrays.DisallowShortArraySyntaxsniff, this sniff will ignore short list syntax and not cause parse errors when the fixer is used. - :wrench: :bar_chart: :books: New
Universal.Constants.UppercaseMagicConstantssniff to enforce that PHP native magic constants are in uppercase. #64 - :bar_chart: :books: New
Universal.Namespaces.DisallowDeclarationWithoutNamesniff to disallow namespace declarations without a namespace name. #50 - :bar_chart: :books: New
Universal.Operators.DisallowLogicalAndOrsniff to enforce the use of the boolean&&and||operators instead of the logicaland/oroperators. #52 Note: as the operator precedence of the logical operators is significantly lower than the operator precedence of boolean operators, this sniff does not contain an auto-fixer. - :bar_chart: :books: New
Universal.Operators.DisallowShortTernarysniff to disallow the use of short ternaries?:. #42 While short ternaries are useful when used correctly, the principle of them is often misunderstood and they are more often than not used incorrectly, leading to hard to debug issues and/or PHP warnings/notices. - :wrench: :bar_chart: :books: New
Universal.Operators.DisallowStandalonePostIncrementDecrementsniff disallow the use of post-in/decrements in stand-alone statements and discourage the use of multiple increment/decrement operators in a stand-alone statement. #65 - :wrench: :bar_chart: :books: New
Universal.Operators.StrictComparisonssniff to enforce the use of strict comparisons. #48 Warning: the auto-fixer for this sniff may cause bugs in applications and should be used with care! This is considered a risky fixer. - :wrench: :bar_chart: :books: New
Universal.OOStructures.AlphabeticExtendsImplementssniff to verify that the names used in a class "implements" statement or an interface "extends" statement are listed in alphabetic order. #55- This sniff contains a public
orderbyproperty to determine the sort order to use for the statement. If all names used are unqualified, the sort order won't make a difference. However, if one or more of the names are partially or fully qualified, the chosen sort order will determine how the sorting between unqualified, partially and fully qualified names is handled. The sniff supports two sort order options:- 'name' : sort by the interface name only (default);
- 'full' : sort by the full name as used in the statement (without leading backslash). In both cases, the sorting will be done using natural sort, case-insensitive.
- The sniff has modular error codes to allow for selective inclusion/exclusion:
ImplementsWrongOrder- for "class implements" statements.ImplementsWrongOrderWithComments- for "class implements" statements interlaced with comments. These will not be auto-fixed.ExtendsWrongOrder- for "interface extends" statements.ExtendsWrongOrderWithComments- for "interface extends" statements interlaced with comments. These will not be auto-fixed.
- When fixing, the existing spacing between the names in an
implements/extendsstatement will not be maintained. The fixer will separate each name with a comma and one space. If alternative formatting is desired, a sniff which will check and fix the formatting should be added to the ruleset.
- This sniff contains a public
- :wrench: :bar_chart: :books: New
Universal.UseStatements.LowercaseFunctionConstsniff to enforce thatfunctionandconstkeywords when used in an importusestatement are always lowercase. #58 - :wrench: :bar_chart: :books: New
Universal.UseStatements.NoLeadingBackslashsniff to verify that a name being imported in an importusestatement does not start with a leading backslash. #46 Names in importusestatements should always be fully qualified, so a leading backslash is not needed and it is strongly recommended not to use one. This sniff handles all types of import use statements supported by PHP, in contrast to other sniffs for the same in, for instance, the PSR12 or the Slevomat standard, which are incomplete. - :wrench: :books: New
Universal.WhiteSpace.DisallowInlineTabssniff to enforce using spaces for mid-line alignment. #43
Changed
Other
- The
masterbranch has been renamed tostable. - Composer: The version requirements for the [Composer PHPCS plugin] have been widened to allow for version 0.7.0 which supports Composer 2.0.0. #62
- Various housekeeping.
- :wrench: :books: New
-
1.0.0-alpha218 Feb 2020 pre-releaseRelease notes
Open source →Added
Universal
- :wrench: :bar_chart: :books: New
Universal.ControlStructures.DisallowAlternativeSyntaxsniff to disallow using the alternative syntax for control structures. #23- This sniff contains a
allowWithInlineHTMLproperty to allow alternative syntax when inline HTML is used within the control structure. In all other cases, the use of the alternative syntax will still be disallowed. - The sniff has modular error codes to allow for making exceptions based on specific control structures and/or specific control structures in combination with inline HTML.
- This sniff contains a
- :bar_chart:
Universal.UseStatements.DisallowUseClass/Function/Const: new, additional metrics about the import source will be shown in theinforeport. #25
Other
- Readme: installation instructions and sniff list. #26
Changed
Universal
Universal.Arrays.DuplicateArrayKey: wording of the error message. #18Universal.UseStatements.DisallowUseClass/Function/Const: the error codes have been made more modular. #25 Each of these sniffs now has four additional error codes: <ul> <li><code>FoundSameNamespace</code>, <code>FoundSameNamespaceWithAlias</code> for <code>use</code> statements importing from the same namespace;</li> <li><code>FoundGlobalNamespace</code>, <code>FoundGlobalNamespaceWithAlias</code> for <code>use</code> statements importing from the global namespace, like import statements for PHP native classes, functions and constants.</li> </ul> In all other circumstances, the existing error codes <code>FoundWithAlias</code> and <code>FoundWithoutAlias</code> will continue to be used.
Other
- Improved formatting of the CLI documentation which can be viewed using
--generator=text. #17 - Various housekeeping.
Fixed
Universal
Universal.Arrays.DuplicateArrayKey: improved handling of parse errors. #34Universal.ControlStructures.IfElseDeclaration: the fixer will now respect tab indentation. #19Universal.UseStatements.DisallowUseClass/Function/Const: the determination of whether a import is aliased in now done in a case-insensitive manner. #25Universal.UseStatements.DisallowUseClass/Function/Const: an import from the global namespace would previously always be seen as non-aliased, even when it was aliased. #25Universal.UseStatements.DisallowUseClass/Function/Const: improved tolerance foruseimport statements with leading backslashes. #25
- :wrench: :bar_chart: :books: New
-
1.0.0-alpha123 Jan 2020 pre-releaseRelease notes
Open source →Initial alpha release containing:
- A
NormalizedArraysstandard which will contain a full set of sniffs to check the formatting of array declarations. - A
Universalstandard which will contain a collection of universally applicable sniffs. DO NOT INCLUDE THIS AS A STANDARD.Universal, like the upstream PHPCSGenericstandard, contains sniffs which contradict each other. Include individual sniffs from this standard in a custom project/company ruleset to use them.
This initial alpha release contains the following sniffs:
NormalizedArrays
- :wrench: :bar_chart: :books:
NormalizedArrays.Arrays.ArrayBraceSpacing: enforce consistent spacing for the open/close braces of array declarations. The sniff allows for having different settings for:- Space between the array keyword and the open parenthesis for long arrays via the
keywordSpacingproperty. Accepted values: (int) number of spaces orfalseto turn this check off. Defaults to0spaces. - Spaces on the inside of the braces for empty arrays via the
spacesWhenEmptyproperty. Accepted values: (string)newline, (int) number of spaces orfalseto turn this check off. Defaults to0spaces. - Spaces on the inside of the braces for single-line arrays via the
spacesSingleLineproperty; Accepted values: (int) number of spaces orfalseto turn this check off. Defaults to0spaces. - Spaces on the inside of the braces for multi-line arrays via the
spacesMultiLineproperty. Accepted values: (string)newline, (int) number of spaces orfalseto turn this check off. Defaults tonewline. Note: if any of the above properties are set tonewline, it is recommended to also include an array indentation sniff. This sniff will not handle the indentation.
- Space between the array keyword and the open parenthesis for long arrays via the
- :wrench: :bar_chart: :books:
NormalizedArrays.Arrays.CommaAfterLast: enforce/forbid a comma after the last item in an array declaration. By default, this sniff will: <ul> <li>forbid a comma after the last array item for single-line arrays.</li> <li>enforce a comma after the last array item for multi-line arrays.</li> </ul> This can be changed for each type or array individually by setting the <code>singleLine</code> or <code>multiLine</code> properties in a custom ruleset. The valid values are: <code>enforce</code>, <code>forbid</code> or <code>skip</code> to not check the comma after the last array item for a particular type of array.
Universal
- :books:
Universal.Arrays.DuplicateArrayKey: detects duplicate array keys in array declarations. - :books:
Universal.Arrays.MixedArrayKeyTypes: best practice sniff: don't use a mix of integer and numeric keys for array items. - :books:
Universal.Arrays.MixedKeyedUnkeyedArray: best practice sniff: don't use a mix of keyed and unkeyed array items. - :wrench: :bar_chart: :books:
Universal.ControlStructures.IfElseDeclaration: verify that else(if) statements with braces are on a new line. - :wrench: :bar_chart: :books:
Universal.Lists.DisallowLongListSyntax: disallow the use of longlists. - :wrench: :bar_chart: :books:
Universal.Lists.DisallowShortListSyntax: disallow the use of short lists. - :bar_chart: :books:
Universal.Namespaces.DisallowCurlyBraceSyntax: disallow the use of the alternative namespace declaration syntax using curly braces. - :bar_chart: :books:
Universal.Namespaces.EnforceCurlyBraceSyntax: enforce the use of the alternative namespace syntax using curly braces. - :books:
Universal.Namespaces.OneDeclarationPerFile: disallow the use of multiple namespaces within a file. - :bar_chart: :books:
Universal.UseStatements.DisallowUseClass: forbid using import use statements for classes/traits/interfaces. Individual sub-types can be allowed by excluding specific error codes. - :bar_chart: :books:
Universal.UseStatements.DisallowUseConst: forbid using import use statements for constants. Individual sub-types can be allowed by excluding specific error codes. - :bar_chart: :books:
Universal.UseStatements.DisallowUseFunction: forbid using import use statements for functions. Individual sub-types can be allowed by excluding specific error codes.
- A