Skip to content

figuren-theater/phpstan

Repository files navigation


figuren.theater Logo

figuren.theater | phpstan.neon

org-wide used phpstan.neon file for the WordPress Multisite network for puppeteers - figuren.theater.


Read our blog

See the network in actionJoin the networkCreate your own network

About

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.

Background & Motivation

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

Install via command line

composer require --dev figuren-theater/phpstan

Usage

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

Built with & uses

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Versioning

We use Semantic Versioning for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the GPL-3.0-or-later, see the LICENSE file for details

Acknowledgments

About

org-wide used phpstan.neon file for the figuren.theater platform

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages