Skip to content

Better PHP7 support, more diagnostics, less false positives

Pre-release
Pre-release
Compare
Choose a tag to compare
@quasilyte quasilyte released this 14 Apr 19:27
· 564 commits to master since this release
d9b6dda

The PHP7 support is still incomplete, but we're getting closer to fix that.

NoVerify works well in self-contained codebases that have all dependencies under their source root. It also requires all types to be resolvable and reports most usages of mixed-typed values as errors. We aware that it could be too strict for many users, perhaps there will be a flag that makes NoVerify more tolerant of untyped code in the future.

Feedback is appreciated.

How to get started

  1. Download a binary for your platform.
  2. Run NoVerify over your PHP project with noverify ./src/.

Try to avoid running NoVerify over a code that can include definition duplicates. It complicates running analysis over tests, but we're working on making this limitation go away.

More usage info: docs/linter-usage.md.

To list supported diagnostics run noverify --help. Example output:

Diagnostics (checks):
  accessLevel
    	Report erroneous member access.
  argCount
    	Report mismatching args count inside call expressions.
  arrayAccess
    	Report array access to non-array objects.
(+ more lines)

Recent changes

New checkers:

  • regexpSimplify tells how to simplify patterns
  • regexpVet finds suspicious pattern parts
  • regexpSyntax reports syntax errors in patterns
  • newAbstract forbids using abstract classes in new expressions
  • nameCase requires the same spelling of classes and functions at definitions and usages
  • unimplemented reports unimplemented interface/abstract methods
  • misspell finds common misspellings in comments and some identifiers
  • discardExpr reports "evaluated but not used" expressions
  • voidResultUsed reports usage of void-typed expressions

Improvements:

  • For simple use cases there is no need to set -cache now
  • Linter now understand traits better
  • isset/instanceof inside ternary expression condition is now respected (#288)
  • Linter now collects info from @method and @property annotations
  • Nullable types ?T are now supported
  • function_exists() and method_exists() permit calling tested symbol inside if body
  • Several improvements to a types inference
  • UNUSED severity level is not used in non-LSP mode (#397)
  • Case-insensitive symbols handling is improved

Performance:

  • Directory traversal speed is increased significantly (#333)
  • Lexing became 5-10% faster due to golex -> Ragel switch (#381)

Bug fixes:

  • PHP7 style nowdoc/heredoc are now parsed correctly (#327)

Documentation: