@@ -10,12 +10,51 @@ Static analysis for the WordPress ecosystem.
10
10
- [ PHPStan] ( https://phpstan.org/ )
11
11
- [ WordPress] ( https://wordpress.org/ )
12
12
13
+ ### Installation
14
+
15
+ Add this package to your project.
16
+
17
+ ``` bash
18
+ composer require --dev szepeviktor/phpstan-wordpress
19
+ ```
20
+
21
+ Make PHPStan find it automatically using ` phpstan/extension-installer ` .
22
+
23
+ ``` bash
24
+ composer require --dev phpstan/extension-installer
25
+ ```
26
+
27
+ Or manually include it in your ` phpstan.neon ` .
28
+
29
+ ``` neon
30
+ includes:
31
+ - vendor/szepeviktor/phpstan-wordpress/extension.neon
32
+ ```
33
+
34
+ ### Configuration
35
+
36
+ Needs no extra configuration. :smiley : Simply configure PHPStan - for example - this way.
37
+
38
+ ``` neon
39
+ parameters:
40
+ level: 5
41
+ paths:
42
+ - plugin.php
43
+ - inc/
44
+ ```
45
+
46
+ Please read [ PHPStan Config Reference] ( https://phpstan.org/config-reference ) .
47
+
48
+ :bulb : Use Composer autoloader or a
49
+ [ custom autoloader] ( https://github.com/szepeviktor/debian-server-tools/blob/master/webserver/wp-install/wordpress-autoloader.php ) !
50
+
13
51
### Usage
14
52
15
- 1 . Set up Composer, add ` szepeviktor/phpstan-wordpress ` , autoload your plugin or theme, see ` example/composer.json `
16
- 1 . Set up PHPStan, see ` example/phpstan.neon.dist ` - if you don't use Composer autoloading add ` autoload_files: ` and/or ` autoload_directories: `
17
- 1 . Get packages ` composer update --optimize-autoloader `
18
- 1 . Start analysis ` vendor/bin/phpstan analyze `
53
+ Just start the analysis: ` vendor/bin/phpstan analyze `
54
+ then fix an error and ` GOTO 10 ` !
55
+
56
+ You find futher information in the ` example ` directory
57
+ e.g. [ ` example/phpstan.neon.dist ` ] ( /example/phpstan.neon.dist )
19
58
20
59
### Usage in WooCommerce webshops
21
60
0 commit comments