1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/phpstan.md

29 lines
842 B
Markdown
Raw Normal View History

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
- Analyze one or more directories:
2018-02-28 21:43:29 +00: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}}`
- Display available options for analysis:
`phpstan analyse --help`