Forrest logo
back to the phpstan tool

phpstan:analyze

Analyze using a specific rule level (0-7, higher is stricter).
$ phpstan analyse ${path/to/directory} --level ${level}
try on your machine

This is a command that uses the PHPStan tool to analyze a given directory's PHP code and checks for issues such as type mismatches, undefined variables, and other potential errors.

The command takes in two arguments:

  1. ${path/to/directory} is the path of the directory where the PHP code is located that you want to analyze.
  2. --level ${level} is an optional argument that specifies the minimum level of the issues to report; for example, level 0 reports only syntax errors, while level 7 reports on all errors and code style violations.

So once you run the command, PHPStan will analyze the PHP code in the specified directory and output any detected issues of the specified level (if provided) to the terminal.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the phpstan tool