org-wide used phpstan.neon file for the WordPress Multisite network for puppeteers - figuren.theater.
Read our blog
See the network in action
•
Join the network
•
Create your own network
The configuration is loaded automatically by phpstan/extension-installer and can be overwritten per project with a custom phpstan.neon
file in the project root folder.
This is a part of the figuren.theater code-quality package and delivers a default configuration for phpstan throughout the whole platform and (not yet) all of its repos. It further helps reducing the need for an individual phpstan.neon
file in every repository.
Install via command line
composer require --dev figuren-theater/phpstan
vendor/bin/phpstan analyze .
Create a phpstan.neon
file inside the project root with something like this:
#$ vendor/bin/phpstan analyze
includes:
# Already included
# @see https://github.com/phpstan/phpstan-src/blob/master/conf/bleedingEdge.neon
- phar://phpstan.phar/conf/bleedingEdge.neon
# Include this extension, if not already autoloaded via composer
# - vendor/szepeviktor/phpstan-wordpress/extension.neon
parameters:
level: max
inferPrivatePropertyTypeFromConstructor: true
bootstrapFiles:
# Missing constants, function and class stubs
# - %currentWorkingDirectory%/tests/phpstan/bootstrap.php
# - %currentWorkingDirectory%/tests/static-analysis-stubs/wordpress-defines.stub
# - %currentWorkingDirectory%/vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
# scanFiles:
# Plugin stubs
# - %currentWorkingDirectory%/tests/phpstan/PLUGIN-stubs.php
# Procedural code
# - %currentWorkingDirectory%/myplugin-functions.php
# autoload_directories:
# - %currentWorkingDirectory%/inc/
paths:
- %currentWorkingDirectory%/plugin.php
- %currentWorkingDirectory%/inc/
# - %currentWorkingDirectory%/templates/
excludePaths:
- %currentWorkingDirectory%/vendor/
ignoreErrors:
# Uses func_get_args()
# - '#^Function apply_filters(_ref_array)? invoked with [34567] parameters, 2 required\.$#'
# Fixed in WordPress 5.3
#- '#^Function do_action(_ref_array)? 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\.$#'
#- '#^Function wp_sprintf invoked with [23456] parameters, 1 required\.$#'
#- '#^Function add_post_type_support invoked with [345] parameters, 2 required\.$#'
#- '#^Function ((get|add)_theme_support|current_theme_supports) invoked with [2345] parameters, 1 required\.$#'
# Fixed in WordPress 5.2 - https://core.trac.wordpress.org/ticket/43304
#- '/^Parameter #2 \$deprecated of function load_plugin_textdomain expects string, false given\.$/'
# WP-CLI accepts a class name as callable
# - '/^Parameter #2 \$callable of static method WP_CLI::add_command\(\) expects callable\(\): mixed, \S+ given\.$/'
# Please consider commenting ignores: issue URL or reason for ignoring
# dynamicConstantNames:
# - SCRIPT_DEBUG
- dependabot
- phpstan/extension-installer
- code-quality A set of status checks to ensure high and consitent code-quality for the figuren.theater platform.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
We use Semantic Versioning for versioning. For the versions available, see the tags on this repository.
- Carsten Bach - Provided idea & code - figuren.theater/crew
See also the list of contributors who participated in this project.
This project is licensed under the GPL-3.0-or-later, see the LICENSE file for details
- altis by humanmade, as our digital role model and inspiration
- @roborourke for his clear & understandable coding guidelines
- python-project-template for their nice template->repo renaming workflow