Skip to content
Permalink
Browse files

added phpstan

  • Loading branch information...
Mte90 committed May 7, 2019
1 parent b868b86 commit 34bf7a0b018363816488dfda94c577ce6c43e833
Showing with 28 additions and 0 deletions.
  1. +1 −0 README.md
  2. +1 −0 plugin-name/composer.json
  3. +26 −0 plugin-name/phpstan.neon
@@ -17,6 +17,7 @@ Choose a library or a snippet and the boilerplate (with the help of the Code Gen
* [Code Generator](https://github.com/WPBP/generator) to start to develop
* Sass support, CoffeScript and Grunt (not mandatory because the generator can remove them)
* Autoload based on Composer but [extended](https://github.com/WPBP/WordPress-Plugin-Boilerplate-Powered/blob/master/plugin-name/engine/class-initialize.php)
* Tools integrated like [GrumpPHP](https://github.com/phpro/grumphp) (automatically on commit) and [PHPStan](https://github.com/phpstan/phpstan/) (`php7.2 vendor/bin/phpstan analyze`)
* Many libraries already available (with starter code) for Composer

| WPBP Libraries | Other libraries |
@@ -50,6 +50,7 @@
}
],
"require-dev": {
"szepeviktor/phpstan-wordpress": "^0.1.0",
"lucatume/wp-browser": "2.*",
"lucatume/function-mocker": "~1.0",
"phpro/grumphp": "^0.15",
@@ -0,0 +1,26 @@
# Start command: composer update --classmap-authoritative && vendor/bin/phpstan analyze

includes:
# https://github.com/phpstan/phpstan/blob/master/conf/bleedingEdge.neon
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
- vendor/szepeviktor/phpstan-wordpress/extension.neon
parameters:
level: max
paths:
- %currentWorkingDirectory%
excludes_analyse:
- %currentWorkingDirectory%/vendor
- %currentWorkingDirectory%/tests
autoload_files:
# Procedural code
- %currentWorkingDirectory%/plugin-name.php
ignoreErrors:
# Uses func_get_args()
- '#^Function apply_filters invoked with [34567] parameters, 2 required\.$#'
- '#^Function do_action invoked with [3456] parameters, 1-2 required\.$#'
- '#^Function current_user_can invoked with 2 parameters, 1 required\.$#'
- '#^Function add_query_arg invoked with [123] parameters?, 0 required\.$#'
# https://core.trac.wordpress.org/ticket/43304
- '/^Parameter #2 \$deprecated of function load_plugin_textdomain expects string, false given\.$/'
# WP-CLI accepts a class as callable
- '/^Parameter #2 \$callable of static method WP_CLI::add_command\(\) expects callable\(\): mixed, \S+ given\.$/'

0 comments on commit 34bf7a0

Please sign in to comment.
You can’t perform that action at this time.