Skip to content

1.0.0-alpha1 - 2020-01-23

Pre-release
Pre-release
Compare
Choose a tag to compare
@jrfnl jrfnl released this 23 Jan 17:05
8670f18

Initial alpha release containing:

  • A NormalizedArrays standard which will contain a full set of sniffs to check the formatting of array declarations.
  • A Universal standard which will contain a collection of universal sniffs.
    DO NOT INCLUDE THIS AS A STANDARD.
    Universal, like the upstream PHPCS Generic standard, 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

  • 🔧 📊 📚 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 keywordSpacing property.
      Accepted values: (int) number of spaces or false to turn this check off. Defaults to 0 spaces.
    • Spaces on the inside of the braces for empty arrays via the spacesWhenEmpty property.
      Accepted values: (string) newline, (int) number of spaces or false to turn this check off. Defaults to 0 spaces.
    • Spaces on the inside of the braces for single-line arrays via the spacesSingleLine property;
      Accepted values: (int) number of spaces or false to turn this check off. Defaults to 0 spaces.
    • Spaces on the inside of the braces for multi-line arrays via the spacesMultiLine property.
      Accepted values: (string) newline, (int) number of spaces or false to turn this check off. Defaults to newline.
      Note: if any of the above properties are set to newline, it is recommended to also include an array indentation sniff. This sniff will not handle the indentation.
  • 🔧 📊 📚 NormalizedArrays.Arrays.CommaAfterLast: enforce/forbid a comma after the last item in an array declaration.
    By default, this sniff will:
    • forbid a comma after the last array item for single-line arrays.
    • enforce a comma after the last array item for multi-line arrays.
    This can be changed for each type or array individually by setting the singleLine or multiLine properties in a custom ruleset. The valid values are: enforce, forbid or skip to not check the comma after the last array item for a particular type of array.

Universal

  • 📚 Universal.Arrays.DuplicateArrayKey: detects duplicate array keys in array declarations.
  • 📚 Universal.Arrays.MixedArrayKeyTypes: best practice sniff: don't use a mix of integer and numeric keys for array items.
  • 📚 Universal.Arrays.MixedKeyedUnkeyedArray: best practice sniff: don't use a mix of keyed and unkeyed array items.
  • 🔧 📊 📚 Universal.ControlStructures.IfElseDeclaration: verify that else(if) statements with braces are on a new line.
  • 🔧 📊 📚 Universal.Lists.DisallowLongListSyntax: disallow the use of long lists.
  • 🔧 📊 📚 Universal.Lists.DisallowShortListSyntax: disallow the use of short lists.
  • 📊 📚 Universal.Namespaces.DisallowCurlyBraceSyntax: disallow the use of the alternative namespace declaration syntax using curly braces.
  • 📊 📚 Universal.Namespaces.EnforceCurlyBraceSyntax: enforce the use of the alternative namespace syntax using curly braces.
  • 📚 Universal.Namespaces.OneDeclarationPerFile: disallow the use of multiple namespaces within a file
  • 📊 📚 Universal.UseStatements.DisallowUseClass: forbid using import use statements for classes/traits/interfaces.
    Individual sub-types can be allowed by excluding specific error codes.
  • 📊 📚 Universal.UseStatements.DisallowUseConst: forbid using import use statements for constants.
    Individual sub-types can be allowed by excluding specific error codes.
  • 📊 📚 Universal.UseStatements.DisallowUseFunction: forbid using import use statements for functions.
    Individual sub-types can be allowed by excluding specific error codes.