The phpstan:init command sets up basic configuration for PHPStan in a PHP library.
vendor/bin/whitecat phpstan:init
The command does not accept any additional options or arguments. It automatically detects the presence of PHPStan in the require-dev section of the composer.json file.
To execute the phpstan:init command, run the following:
vendor/bin/whitecat phpstan:init
The command performs the following tasks:
- Checks if PHPStan is installed as a development dependency.
- If PHPStan is not installed, it displays a warning message with instructions on how to install it using Composer.
- Copies the
phpstan.neonconfiguration file to the specified distribution directory.
The command prompts the user for confirmation in the following scenario:
- If the
phpstan.neonfile already exists, the user can choose to override it.
Upon successful execution, the command outputs a success message.
If any errors occur during the validation or file copying process, appropriate error messages are displayed.