Skip to content

Sniffs

Before version 5.4, PHP CompatInfo and its compatibility analyser was monolithic code.

Since version 5.4, PHP CompatInfo used a sniff architecture that simplify maintainability of existing code and allows to extend it more easily.

Each sniff, is in charge to detect a PHP language feature. Here is the list of features supported and their corresponding sniffs :

PHP 5.0

PHP 5.1

PHP 5.2

PHP 5.3

PHP 5.4

PHP 5.5

PHP 5.6

PHP 7.0

PHP 7.1

PHP 7.2

PHP 7.3

PHP 7.4

PHP 8.0

PHP 8.1

PHP 8.2

PHP 8.3

PHP 8.4

Special cases

  • Namespaces declaration have no sniff, because its detected by the VersionResolverVisitor
  • Classes declaration have no sniff, because its detected by the VersionResolverVisitor
  • Interfaces declaration have no sniff, because its detected by the VersionResolverVisitor
  • Traits declaration have no sniff, because its detected by the VersionResolverVisitor
  • Closures are initialized by the VersionResolverVisitor and keywords (this, self, parent, static) are detected with ClosureSniff
  • Arrow functions have no sniff, because its detected by the VersionResolverVisitor, but has its test case with ArrowFunctionSniffTest