@@ -17,3 +17,29 @@ To run PHPStan, simply execute the following command (`<path>` is only required
...
@@ -17,3 +17,29 @@ To run PHPStan, simply execute the following command (`<path>` is only required
```sh
```sh
vendor/bin/phpstan analyse <path>
vendor/bin/phpstan analyse <path>
```
```
### Dependencies between plugins
Besides WordPress and WooCommerce, it may be sometimes necessary to analyse dependencies between plugins, e.g. when developing an extension to base plugin, PHPStan needs to be aware of the dependent plugin's codebase.
In such cases it is necessary to generate the stubs for the dependent plugin with the use of [stub generator library](https://github.com/php-stubs/generator). Try to install it as system-wide utility, rather than plugin's package.
```sh
composer global require php-stubs/generator
```
With the aid of this library, you will be able to provide read-only access to the dependent codebase for PHPStan purposes. Use `stub` extension to ignore this file by your editor analyzers.