wp-statuses
wp-statuses copied to clipboard
Benefit from static analysis
Please try running @phpstan on raising levels.
phpstan.neon.dist
#$ composer require --dev szepeviktor/phpstan-wordpress
#$ vendor/bin/phpstan analyze -l 0
includes:
- vendor/szepeviktor/phpstan-wordpress/extension.neon
parameters:
level: max
inferPrivatePropertyTypeFromConstructor: true
paths:
- wp-statuses.php
- inc/
autoload_files:
- wp-statuses.php
- inc/core/functions.php
- inc/core/custom.php
- inc/core/classes/class-wp-statuses-core-status.php
- inc/admin/classes/class-wp-statuses-admin.php
dynamicConstantNames:
- EMPTY_TRASH_DAYS
ignoreErrors:
# Uses func_get_args()
- '#^Function apply_filters(_ref_array)? invoked with [34567] parameters, 2 required\.$#'
# TODO Define properties!
- '#^Access to an undefined property WP_Statuses::\$[a-z_]+\.$#'
# TODO Specify type hints!
- '# has no return typehint specified\.$#'
# It is a PHPStan bug.
- '#^Parameter \#1 \$autoload_function of function spl_autoload_register expects callable\(string\): #'
# TODO Remove!
checkMissingIterableValueType: false
e.g. defined( 'ABSPATH' ) || exit; properly and testable looks like
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
PHPStan is able to detect problems hidden for the human eye.
Interesting, I was thinking about using PHPCS along with WP code formatting config. Thanks for you feedback.