2018-02-28 21:43:29 +00:00
|
|
|
# phpstan
|
|
|
|
|
|
|
|
> A PHP static analysis tool to discover bugs in code.
|
2025-03-15 22:54:52 +01:00
|
|
|
> More information: <https://phpstan.org/user-guide/command-line-usage>.
|
2018-02-28 21:43:29 +00:00
|
|
|
|
2024-01-31 00:55:19 -03:00
|
|
|
- Analyze one or more directories:
|
2018-02-28 21:43:29 +00:00
|
|
|
|
2024-01-31 00:55:19 -03:00
|
|
|
`phpstan analyse {{path/to/directory1 path/to/directory2 ...}}`
|
2018-02-28 21:43:29 +00:00
|
|
|
|
2022-06-27 12:23:12 +02:00
|
|
|
- Analyze a directory using a configuration file:
|
2018-02-28 21:43:29 +00:00
|
|
|
|
2025-03-15 22:54:52 +01:00
|
|
|
`phpstan analyse {{path/to/directory}} {{[-c|--configuration]}} {{path/to/config}}`
|
2018-02-28 21:43:29 +00:00
|
|
|
|
2025-03-15 22:54:52 +01:00
|
|
|
- Analyze using a specific rule level (0-10, higher is stricter):
|
2018-02-28 21:43:29 +00:00
|
|
|
|
2025-03-15 22:54:52 +01:00
|
|
|
`phpstan analyse {{path/to/directory}} {{[-l|--level]}} {{level}}`
|
2018-02-28 21:43:29 +00:00
|
|
|
|
2022-06-27 12:23:12 +02:00
|
|
|
- Specify an autoload file to load before analyzing:
|
2018-02-28 21:43:29 +00:00
|
|
|
|
2025-03-15 22:54:52 +01:00
|
|
|
`phpstan analyse {{path/to/directory}} {{[-a|--autoload-file]}} {{path/to/autoload_file}}`
|
2018-02-28 21:43:29 +00:00
|
|
|
|
|
|
|
- Specify a memory limit during analysis:
|
|
|
|
|
|
|
|
`phpstan analyse {{path/to/directory}} --memory-limit {{memory_limit}}`
|
2024-01-30 01:55:24 -03:00
|
|
|
|
|
|
|
- Display available options for analysis:
|
|
|
|
|
|
|
|
`phpstan analyse --help`
|