Skip to content

Commit

Permalink
split sniffs documentation by PHP version
Browse files Browse the repository at this point in the history
  • Loading branch information
llaville committed Dec 1, 2024
1 parent 250e919 commit 92ab4b1
Show file tree
Hide file tree
Showing 18 changed files with 276 additions and 236 deletions.
10 changes: 10 additions & 0 deletions docs/components/sniffs/PHP50.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!-- markdownlint-disable MD013 -->
# PHP 5.0

| Sniff category | Sniff class name | PHP Feature |
|----------------|--------------------------|---------------------------------------|
| Classes | MethodDeclarationSniff | [Method Visibility][MethodVisibility] |
| Classes | PropertyDeclarationSniff | [Properties][Properties] |

[MethodVisibility]: https://www.php.net/manual/en/language.oop5.visibility.php#language.oop5.visiblity-methods
[Properties]: https://www.php.net/manual/en/language.oop5.properties.php
8 changes: 8 additions & 0 deletions docs/components/sniffs/PHP51.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!-- markdownlint-disable MD013 -->
# PHP 5.1

| Sniff category | Sniff class name | PHP Feature |
|----------------|-------------------|---------------------------------|
| Classes | MagicMethodsSniff | [Magic Methods][MagicMethods51] |

[MagicMethods51]: https://www.php.net/manual/en/language.oop5.magic.php
6 changes: 6 additions & 0 deletions docs/components/sniffs/PHP52.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!-- markdownlint-disable MD013 -->
# PHP 5.2

| Sniff category | Sniff class name | PHP Feature |
|----------------|------------------|-------------|
| | | |
24 changes: 24 additions & 0 deletions docs/components/sniffs/PHP53.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!-- markdownlint-disable MD013 -->
# PHP 5.3

| Sniff category | Sniff class name | PHP Feature |
|----------------------|---------------------------|------------------------------------------------------|
| Classes | MagicMethodsSniff | [Magic Methods][MagicMethods53] |
| Classes | DynamicAccessSniff | Dynamic Static Method access |
| Classes | DynamicAccessSniff | Dynamic Static Property access |
| ControlStructures | DeclareSniff | [Declare][Declare53] |
| ControlStructures | GotoSniff | [Goto][Goto] |
| FunctionDeclarations | ClosureSniff | [Anonymous functions][AnonymousFunctions] |
| | `VersionResolverVisitor` | [Closures][Closures] |
| Operators | ShortTernaryOperatorSniff | [Ternary Operator][ShortTernaryOperator] |
| | `VersionResolverVisitor` | [Namespaces][Namespaces] |
| TextProcessing | CryptStringSniff | [CRYPT_BLOWFISH security fix details][CryptBlowfish] |

[MagicMethods53]: https://www.php.net/manual/en/language.oop5.magic.php
[Declare53]: https://www.php.net/manual/en/control-structures.declare.php
[Goto]: https://www.php.net/manual/en/control-structures.goto.php
[AnonymousFunctions]: https://www.php.net/manual/en/functions.anonymous.php
[Closures]: https://www.php.net/manual/en/functions.anonymous.php
[ShortTernaryOperator]: https://www.php.net/manual/en/language.operators.comparison.php#language.operators.comparison.ternary
[Namespaces]: https://www.php.net/manual/en/language.namespaces.php
[CryptBlowfish]: https://www.php.net/security/crypt_blowfish.php
19 changes: 19 additions & 0 deletions docs/components/sniffs/PHP54.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- markdownlint-disable MD013 -->
# PHP 5.4

| Sniff category | Sniff class name | PHP Feature |
|-----------------|-------------------------------|-----------------------------------------------------------|
| Arrays | ArrayDereferencingSyntaxSniff | [Array dereferencing][ArrayDereferencingSyntax] |
| Arrays | ShortArraySyntaxSniff | [Short array syntax][ShortArraySyntax] |
| Classes | ClassMemberAccessSniff | [Class member access on instantiation][ClassMemberAccess] |
| Expressions | ClassExprSyntaxSniff | [Class::{expr}() syntax][ClassExprSyntax] |
| Numbers | BinaryNumberFormatSniff | [Binary number format][BinaryNumberFormat] |
| UseDeclarations | UseTraitSniff | [Traits][UseTrait] |
| | `VersionResolverVisitor` | [Traits][UseTrait] |

[ArrayDereferencingSyntax]: https://www.php.net/manual/en/migration54.new-features.php
[ShortArraySyntax]: https://www.php.net/manual/en/migration54.new-features.php
[ClassMemberAccess]: https://wiki.php.net/rfc/instance-method-call
[ClassExprSyntax]: https://www.php.net/manual/en/migration54.new-features.php
[BinaryNumberFormat]: https://www.php.net/manual/en/migration54.new-features.php
[UseTrait]: https://www.php.net/manual/en/language.oop5.traits.php
12 changes: 12 additions & 0 deletions docs/components/sniffs/PHP55.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- markdownlint-disable MD013 -->
# PHP 5.5

| Sniff category | Sniff class name | PHP Feature |
|----------------|-------------------------|-------------------------------------------------|
| Constants | MagicClassConstantSniff | [::class syntax][MagicClass] |
| Expressions | EmptySniff | [empty() supports arbitrary expressions][Empty] |
| Generators | GeneratorSniff | [Generators][Generators] |

[MagicClass]: https://wiki.php.net/rfc/class_name_literal_on_object
[Empty]: https://www.php.net/manual/en/migration55.new-features.php#migration55.new-features.empty
[Generators]: https://www.php.net/manual/en/language.generators.php
14 changes: 14 additions & 0 deletions docs/components/sniffs/PHP56.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- markdownlint-disable MD013 -->
# PHP 5.6

| Sniff category | Sniff class name | PHP Feature |
|-----------------|-----------------------|------------------------------------------------|
| Classes | MagicMethodsSniff | [Magic Methods][MagicMethods56] |
| Constants | ConstSyntaxSniff | [Constant Expressions][ConstScalar] |
| Operators | PowOperatorSniff | [Exponentiation][PowOperator] |
| UseDeclarations | UseConstFunctionSniff | [use function and use const][UseConstFunction] |

[MagicMethods56]: https://www.php.net/manual/en/language.oop5.magic.php
[ConstScalar]: https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.const-scalar-exprs
[PowOperator]: https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.exponentiation
[UseConstFunction]: https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.use
26 changes: 26 additions & 0 deletions docs/components/sniffs/PHP70.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!-- markdownlint-disable MD013 -->
# PHP 7.0

| Sniff category | Sniff class name | PHP Feature |
|----------------------|---------------------------------|----------------------------------------------------|
| FunctionDeclarations | ParamTypeDeclarationSniff | [Scalar type declarations][ScalarTypeDeclarations] |
| FunctionDeclarations | ReturnTypeDeclarationSniff | [Return type declarations][ReturnTypeDeclarations] |
| Keywords | ReservedSniff | [Scalar type declarations][ScalarTypeDeclarations] |
| Operators | NullCoalesceOperatorSniff | [Null coalescing operator][NullCoalesceOperator] |
| Operators | CombinedComparisonOperatorSniff | [Spaceship operator][SpaceshipOperator] |
| | | [Constant arrays using define()][DefineArray] |
| Classes | AnonymousClassSniff | [Anonymous classes][AnonymousClass] |
| Classes | ClassMemberAccessSniff | Class member access on cloning |
| ControlStructures | DeclareSniff | [Declare][Declare70] |
| Generators | GeneratorSniff | [Generator Return Expressions][GeneratorReturn] |
| Generators | GeneratorSniff | [Generator Delegation][GeneratorDelegation] |

[ScalarTypeDeclarations]: https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.scalar-type-declarations
[ReturnTypeDeclarations]: https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.return-type-declarations
[NullCoalesceOperator]: https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.null-coalesce-op
[SpaceshipOperator]: https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.spaceship-op
[DefineArray]: https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.define-array
[AnonymousClass]: https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.anonymous-classes
[Declare70]: https://www.php.net/manual/en/control-structures.declare.php
[GeneratorReturn]: https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.generator-return-expressions
[GeneratorDelegation]: https://www.php.net/manual/en/language.generators.syntax.php#control-structures.yield.from
22 changes: 22 additions & 0 deletions docs/components/sniffs/PHP71.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- markdownlint-disable MD013 -->
# PHP 7.1

| Sniff category | Sniff class name | PHP Feature |
|----------------------|----------------------------|--------------------------------------------------------------|
| FunctionDeclarations | ParamTypeDeclarationSniff | [Nullable types][NullableTypes] |
| FunctionDeclarations | ReturnTypeDeclarationSniff | [Nullable types][NullableTypes] |
| FunctionDeclarations | ReturnTypeDeclarationSniff | [Void functions][VoidFunctions] |
| | | [Symmetric array destructuring][SymmetricArrayDestructuring] |
| | | [Class constant visibility][ClassConstantVisibility] |
| FunctionDeclarations | ParamTypeDeclarationSniff | [iterable pseudo-type][IterableType] |
| Keywords | ReservedSniff | [iterable pseudo-type][IterableType] |
| | | [Multi catch exception handling][MultiCatchException] |
| | | [Support for keys in list()][SupportKeysInList] |

[NullableTypes]: https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.nullable-types
[VoidFunctions]: https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.void-functions
[SymmetricArrayDestructuring]: https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.symmetric-array-destructuring
[ClassConstantVisibility]: https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.class-constant-visibility
[IterableType]: https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.iterable-pseudo-type
[MultiCatchException]: https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.mulit-catch-exception-handling
[SupportKeysInList]: https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.support-for-keys-in-list
8 changes: 8 additions & 0 deletions docs/components/sniffs/PHP72.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!-- markdownlint-disable MD013 -->
# PHP 7.2

| Sniff category | Sniff class name | PHP Feature |
|----------------|------------------|---------------------------------------|
| Keywords | ReservedSniff | [New object type][ReservedKeywords72] |

[ReservedKeywords72]: https://www.php.net/manual/en/migration72.new-features.php#migration72.new-features.object-type
8 changes: 8 additions & 0 deletions docs/components/sniffs/PHP73.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!-- markdownlint-disable MD013 -->
# PHP 7.3

| Sniff category | Sniff class name | PHP Feature |
|----------------|---------------------|------------------------------------------------------|
| FunctionCalls | SameSiteCookieSniff | [SetCookie accept $options argument][SameSiteCookie] |

[SameSiteCookie]: https://www.php.net/manual/en/migration73.other-changes.php#migration73.other-changes.core.setcookie
13 changes: 13 additions & 0 deletions docs/components/sniffs/PHP74.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- markdownlint-disable MD013 -->
# PHP 7.4

| Sniff category | Sniff class name | PHP Feature |
|----------------------|---------------------------|----------------------------------------------------------------------------|
| Arrays | ArrayUnpackingSyntaxSniff | [Array unpacking support for numeric-keyed arrays][ArrayUnpackingSyntax74] |
| Classes | TypedPropertySniff | [Typed properties][TypedProperties] |
| FunctionDeclarations | ArrowFunctionSniff | [Arrow functions][ArrowFunctions] |
| | `VersionResolverVisitor` | [Arrow functions][ArrowFunctions] |

[ArrayUnpackingSyntax74]: https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.core.unpack-inside-array
[TypedProperties]: https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.core.typed-properties
[ArrowFunctions]: https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.core.arrow-functions
22 changes: 22 additions & 0 deletions docs/components/sniffs/PHP80.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- markdownlint-disable MD013 -->
# PHP 8.0

| Sniff category | Sniff class name | PHP Feature |
|----------------------|-------------------------------|-----------------------------------------------------|
| Attributes | AttributeSniff | [Attributes][Attributes] |
| Classes | PropertyPromotionSniff | [Constructor property promotion][PropertyPromotion] |
| ControlStructures | MatchSniff | [Match expressions][Match] |
| ControlStructures | NonCapturingCatchSniff | [Non-capturing catches][NonCapturingCatch] |
| FunctionDeclarations | NamedArgumentDeclarationSniff | [Named arguments][NamedArgumentDeclaration] |
| FunctionDeclarations | ParamTypeDeclarationSniff | [Union types][UnionTypes] |
| FunctionDeclarations | TrailingCommaSniff | [Trailing comma][TrailingComma] |
| Operators | NullsafeOperatorSniff | [Nullsafe operator][NullsafeOperator] |

[Attributes]: https://www.php.net/releases/8.0/en.php#attributes
[PropertyPromotion]: https://www.php.net/releases/8.0/en.php#constructor-property-promotion
[Match]: https://www.php.net/releases/8.0/en.php#match-expression
[NonCapturingCatch]: https://wiki.php.net/rfc/non-capturing_catches
[NamedArgumentDeclaration]: https://www.php.net/releases/8.0/en.php#named-arguments
[UnionTypes]: https://www.php.net/releases/8.0/en.php#union-types
[TrailingComma]: https://php.watch/versions/8.0/trailing-comma-parameter-use-list
[NullsafeOperator]: https://www.php.net/releases/8.0/en.php#nullsafe-operator
27 changes: 27 additions & 0 deletions docs/components/sniffs/PHP81.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!-- markdownlint-disable MD013 -->
# PHP 8.1

| Sniff category | Sniff class name | PHP Feature |
|----------------------|----------------------------|---------------------------------------------------------------------------|
| Arrays | ArrayUnpackingSyntaxSniff | [Array unpacking support for string-keyed arrays][ArrayUnpackingSyntax81] |
| Classes | ReadonlyPropertySniff | [Readonly Properties][ReadonlyProperty] |
| Classes | NewInitializerSniff | [New initializers][NewInitializer] |
| Constants | ClassConstantSniff | [Final class constants][FinalClassConstant] |
| Enumerations | EnumerationSniff | [Enumerations][Enumerations] |
| Fibers | FiberSniff | [Fibers][Fibers] |
| FunctionDeclarations | FirstClassCallableSniff | [First class callable][FirstClassCallable] |
| FunctionDeclarations | ParamTypeDeclarationSniff | [Pure Intersection Types][PureIntersectionTypes] |
| FunctionDeclarations | ReturnTypeDeclarationSniff | [Pure Intersection Types][PureIntersectionTypes] |
| FunctionDeclarations | ReturnTypeDeclarationSniff | [Never return type][NeverReturnType] |
| Numbers | OctalNumberFormatSniff | [Explicit Octal numeral notation][OctalNumberFormat] |

[ArrayUnpackingSyntax81]: https://www.php.net/releases/8.1/en.php#array_unpacking_support_for_string_keyed_arrays
[ReadonlyProperty]: https://www.php.net/manual/en/language.oop5.properties.php#language.oop5.properties.readonly-properties
[NewInitializer]: https://www.php.net/manual/en/migration81.new-features.php#migration81.new-features.core.new-in-initializer
[FinalClassConstant]: https://www.php.net/releases/8.1/en.php#final_class_constants
[Enumerations]: https://www.php.net/manual/en/migration81.new-features.php#migration81.new-features.core.enums
[Fibers]: https://www.php.net/releases/8.1/en.php#fibers
[FirstClassCallable]: https://www.php.net/manual/en/functions.first_class_callable_syntax.php
[PureIntersectionTypes]: https://www.php.net/releases/8.1/en.php#pure_intersection_types
[NeverReturnType]: https://www.php.net/releases/8.1/en.php#never_return_type
[OctalNumberFormat]: https://www.php.net/releases/8.1/en.php#explicit_octal_numeral_notation
20 changes: 20 additions & 0 deletions docs/components/sniffs/PHP82.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- markdownlint-disable MD013 -->
# PHP 8.2

| Sniff category | Sniff class name | PHP Feature |
|----------------------|----------------------------------------------|-----------------------------------------------------------------------------------------|
| Attributes | AllowDynamicPropertiesAttributeSniff | [AllowDynamicProperties attribute][AllowDynamicPropertiesAttribute] |
| Attributes | SensitiveParameterAttributeSniff | [SensitiveParameter attribute][SensitiveParameterAttribute] |
| Classes | ReadonlyClassSniff | [Readonly Classes][ReadonlyClass] |
| Constants | ConstantsInTraitsSniff | [Constants in Traits][ConstantsInTraits] |
| FunctionDeclarations | ParamTypeDeclarationSniff | [Disjunctive Normal Form Types][DisjunctiveNormalFormTypes] |
| FunctionDeclarations | ReturnTypeDeclarationSniff | [Allow null, false, and true as stand-alone types][AllowNullFalseTrueAsStandaloneTypes] |
| TextProcessing | DeprecateDollarBraceStringInterpolationSniff | [Deprecated \${} string interpolation][DeprecateDollarBraceStringInterpolation] |

[AllowDynamicPropertiesAttribute]: https://www.php.net/manual/en/class.allow-dynamic-properties.php
[SensitiveParameterAttribute]: https://www.php.net/manual/en/class.sensitive-parameter.php
[ReadonlyClass]: https://www.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.readonly
[ConstantsInTraits]: https://www.php.net/manual/en/migration82.new-features.php#migration82.new-features.core.constant-in-traits
[DisjunctiveNormalFormTypes]: https://www.php.net/manual/en/migration82.new-features.php#migration82.new-features.core.type-system
[AllowNullFalseTrueAsStandaloneTypes]: https://wiki.php.net/rfc/true-type
[DeprecateDollarBraceStringInterpolation]: https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation
Loading

0 comments on commit 92ab4b1

Please sign in to comment.