From 9bcac4ba9942126af44e5db0cba9f76cf31b0fdd Mon Sep 17 00:00:00 2001 From: Chris <105302830+datengraben@users.noreply.github.com> Date: Mon, 23 Dec 2024 23:16:23 +0100 Subject: [PATCH 01/20] Create phpstan.yml --- .github/workflows/phpstan.yml | 57 +++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/phpstan.yml diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 000000000..b02c36581 --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,57 @@ +name: PHPStan + +on: + push: + branches: + - 'master' + - 'release/**' + paths-ignore: + - '**.md' + - '**.txt' + pull_request: + branches: + - 'master' + +env: + DB_DATABASE: wordpress_test + DB_USER: root + DB_PASSWORD: '' + +jobs: + phpstan: + name: 'WP latest on PHP 8.3' + + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v4 + + - name: Set up MySQL + run: | + sudo /etc/init.d/mysql start + + - uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + extensions: uopz + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Install dependencies (other PHP versions) + run: | + bash bin/install-wp-tests.sh wordpress_test root root localhost latest + composer install --prefer-dist --no-progress --ignore-platform-reqs + + - name: Run static suite + run: | + composer dump-autoload -o + + + - uses: actions/checkout@v3 + - uses: php-actions/composer@v6 + + - name: PHPStan Static Analysis + uses: php-actions/phpstan@v3 + with: + configuration: phpstan.neon From d7e14d5f38cae97465d7372204b57462dcf221b6 Mon Sep 17 00:00:00 2001 From: Chris <105302830+datengraben@users.noreply.github.com> Date: Mon, 23 Dec 2024 23:20:33 +0100 Subject: [PATCH 02/20] Update phpstan.yml --- .github/workflows/phpstan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index b02c36581..ee77f5aa7 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -48,8 +48,8 @@ jobs: composer dump-autoload -o - - uses: actions/checkout@v3 - - uses: php-actions/composer@v6 + #- uses: actions/checkout@v3 + #- uses: php-actions/composer@v6 - name: PHPStan Static Analysis uses: php-actions/phpstan@v3 From 94ac9ab7132a54d836a94fcabc17fe344aea5484 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 23 Dec 2024 23:25:32 +0100 Subject: [PATCH 03/20] Adds phpstan wp stubs and installer --- composer.json | 7 ++- composer.lock | 161 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 165 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 1de07f415..7232b3860 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,8 @@ "platform-check": false, "allow-plugins": { "php-http/discovery": true, - "dealerdirect/phpcodesniffer-composer-installer": true + "dealerdirect/phpcodesniffer-composer-installer": true, + "phpstan/extension-installer": true } }, "autoload": { @@ -55,6 +56,8 @@ "slope-it/clock-mock": "^0.4.0", "phpunit/php-code-coverage": "^9.2.32", "myclabs/deep-copy": "^1.12.0", - "phpstan/phpstan": "^1.12" + "phpstan/phpstan": "^1.12", + "szepeviktor/phpstan-wordpress": "^1.3", + "phpstan/extension-installer": "^1.4" } } diff --git a/composer.lock b/composer.lock index a02873157..d13a99a74 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a1e4eab161c1593cc128f998fbbd9d15", + "content-hash": "5b9fe8b5e3036d759f14932c21c98e50", "packages": [ { "name": "clue/stream-filter", @@ -2708,6 +2708,54 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "php-stubs/wordpress-stubs", + "version": "v6.7.1", + "source": { + "type": "git", + "url": "https://github.com/php-stubs/wordpress-stubs.git", + "reference": "83448e918bf06d1ed3d67ceb6a985fc266a02fd1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/83448e918bf06d1ed3d67ceb6a985fc266a02fd1", + "reference": "83448e918bf06d1ed3d67ceb6a985fc266a02fd1", + "shasum": "" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "nikic/php-parser": "^4.13", + "php": "^7.4 || ^8.0", + "php-stubs/generator": "^0.8.3", + "phpdocumentor/reflection-docblock": "^5.4.1", + "phpstan/phpstan": "^1.11", + "phpunit/phpunit": "^9.5", + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.1.1", + "wp-coding-standards/wpcs": "3.1.0 as 2.3.0" + }, + "suggest": { + "paragonie/sodium_compat": "Pure PHP implementation of libsodium", + "symfony/polyfill-php80": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "szepeviktor/phpstan-wordpress": "WordPress extensions for PHPStan" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "WordPress function and class declaration stubs for static analysis.", + "homepage": "https://github.com/php-stubs/wordpress-stubs", + "keywords": [ + "PHPStan", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/php-stubs/wordpress-stubs/issues", + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.7.1" + }, + "time": "2024-11-24T03:57:09+00:00" + }, { "name": "phpcompatibility/php-compatibility", "version": "9.3.5", @@ -3078,6 +3126,54 @@ ], "time": "2024-05-20T13:34:27+00:00" }, + { + "name": "phpstan/extension-installer", + "version": "1.4.3", + "source": { + "type": "git", + "url": "https://github.com/phpstan/extension-installer.git", + "reference": "85e90b3942d06b2326fba0403ec24fe912372936" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936", + "reference": "85e90b3942d06b2326fba0403ec24fe912372936", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0", + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.9.0 || ^2.0" + }, + "require-dev": { + "composer/composer": "^2.0", + "php-parallel-lint/php-parallel-lint": "^1.2.0", + "phpstan/phpstan-strict-rules": "^0.11 || ^0.12 || ^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPStan\\ExtensionInstaller\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPStan\\ExtensionInstaller\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer plugin for automatic installation of PHPStan extensions", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpstan/extension-installer/issues", + "source": "https://github.com/phpstan/extension-installer/tree/1.4.3" + }, + "time": "2024-09-04T20:21:43+00:00" + }, { "name": "phpstan/phpstan", "version": "1.12.12", @@ -4655,6 +4751,69 @@ ], "time": "2024-09-18T10:38:58+00:00" }, + { + "name": "szepeviktor/phpstan-wordpress", + "version": "v1.3.5", + "source": { + "type": "git", + "url": "https://github.com/szepeviktor/phpstan-wordpress.git", + "reference": "7f8cfe992faa96b6a33bbd75c7bace98864161e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/7f8cfe992faa96b6a33bbd75c7bace98864161e7", + "reference": "7f8cfe992faa96b6a33bbd75c7bace98864161e7", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "php-stubs/wordpress-stubs": "^4.7 || ^5.0 || ^6.0", + "phpstan/phpstan": "^1.10.31", + "symfony/polyfill-php73": "^1.12.0" + }, + "require-dev": { + "composer/composer": "^2.1.14", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.1", + "phpstan/phpstan-strict-rules": "^1.2", + "phpunit/phpunit": "^8.0 || ^9.0", + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.0", + "wp-coding-standards/wpcs": "3.1.0 as 2.3.0" + }, + "suggest": { + "swissspidy/phpstan-no-private": "Detect usage of internal core functions, classes and methods" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "SzepeViktor\\PHPStan\\WordPress\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "WordPress extensions for PHPStan", + "keywords": [ + "PHPStan", + "code analyse", + "code analysis", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/szepeviktor/phpstan-wordpress/issues", + "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.3.5" + }, + "time": "2024-06-28T22:27:19+00:00" + }, { "name": "theseer/tokenizer", "version": "1.2.3", From c130f649ee2213b582a4af6685de75538edf533a Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 23 Dec 2024 23:28:39 +0100 Subject: [PATCH 04/20] Remove tests scan, remove /tmp stubs include --- phpstan.neon | 4 ---- 1 file changed, 4 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 483172c90..a6b6e0395 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,13 +3,9 @@ parameters: scanFiles: - commonsbooking.php - vendor/cmb2/cmb2/includes/helper-functions.php - scanDirectories: - - /tmp/wordpress - - /tmp/wordpress-tests-lib paths: - commonsbooking.php - src/ - - tests/ - includes/ level: 1 ignoreErrors: From 68fc98f4561f81c78c04fffe9115b1163bd41c15 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 23 Dec 2024 23:32:13 +0100 Subject: [PATCH 05/20] decrese level to 0 again --- phpstan.neon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index a6b6e0395..8a7909aa6 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -7,7 +7,7 @@ parameters: - commonsbooking.php - src/ - includes/ - level: 1 + level: 0 ignoreErrors: - identifier: missingType.iterableValue - '#Constant (COMMONSBOOKING.*|WP_DEBUG_LOG) not found.#' From 96648f30ff44efc2bdf4cfaae7f713da7d6d2c25 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 23 Dec 2024 23:38:13 +0100 Subject: [PATCH 06/20] factor out wp deps after removing /tmp stubs --- .github/workflows/phpstan.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index ee77f5aa7..0de281cac 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -12,11 +12,6 @@ on: branches: - 'master' -env: - DB_DATABASE: wordpress_test - DB_USER: root - DB_PASSWORD: '' - jobs: phpstan: name: 'WP latest on PHP 8.3' @@ -26,10 +21,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up MySQL - run: | - sudo /etc/init.d/mysql start - + # TODO Use the composer action below - uses: shivammathur/setup-php@v2 with: php-version: '8.3' @@ -40,15 +32,13 @@ jobs: - name: Install dependencies (other PHP versions) run: | - bash bin/install-wp-tests.sh wordpress_test root root localhost latest composer install --prefer-dist --no-progress --ignore-platform-reqs - name: Run static suite run: | composer dump-autoload -o - - #- uses: actions/checkout@v3 + #- uses: actions/checkout@v4 #- uses: php-actions/composer@v6 - name: PHPStan Static Analysis From 26719d9c8227602a11a86e3c4ac46ec07e177c30 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 24 Dec 2024 00:11:35 +0100 Subject: [PATCH 07/20] phpstan: fix wrong phpdoc param/return --- includes/TemplateParser.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/TemplateParser.php b/includes/TemplateParser.php index bcebd5049..9e87a7374 100644 --- a/includes/TemplateParser.php +++ b/includes/TemplateParser.php @@ -100,9 +100,9 @@ function commonsbooking_parse_template_callback( $match, array $objects = [], $s /** * Return Custom Post Type postType for template type string * - * @param [type] $type type could be location, booking, item + * @param string $type type could be location, booking, item * - * @return void + * @return string */ function commonsbooking_getCBType( $type ) { if ( $type == 'location' ) { From eae8808c46a58d42b37622adda57d4a02fa47d76 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 24 Dec 2024 00:12:13 +0100 Subject: [PATCH 08/20] phpstan: fix wrong return type --- src/Wordpress/CustomPostType/CustomPostType.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Wordpress/CustomPostType/CustomPostType.php b/src/Wordpress/CustomPostType/CustomPostType.php index c2aa5955f..c68aceddc 100644 --- a/src/Wordpress/CustomPostType/CustomPostType.php +++ b/src/Wordpress/CustomPostType/CustomPostType.php @@ -138,7 +138,7 @@ public static function getCMB2FieldsArrayFromCustomMetadata( $type ): ?array { * * @param mixed $actions * - * @return void + * @return mixed */ public static function modifyRowActions( $actions, $post ) { From 5f8b9960b6e0733ffdfc709b21789e58550269e4 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 24 Dec 2024 00:12:35 +0100 Subject: [PATCH 09/20] phpstan: fix wrong return type --- includes/Admin.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/includes/Admin.php b/includes/Admin.php index b030bfb86..6d2974095 100644 --- a/includes/Admin.php +++ b/includes/Admin.php @@ -287,7 +287,7 @@ function commonsbooking_sanitizeArrayorString( $data, $sanitizeFunction = 'sanit * @param mixed $log can be a string, array or object * @param bool $backtrace if set true the file-path and line of the calling file will be added to the error message * - * @return string logmessage + * @return void */ function commonsbooking_write_log( $log, $backtrace = true ) { @@ -308,6 +308,5 @@ function commonsbooking_write_log( $log, $backtrace = true ) { $logmessage = $file . ':' . $line . ' ' . $logmessage; } - error_log( $logmessage ) ; - + error_log( $logmessage ); } \ No newline at end of file From a96b50c849ddbc39086fb65c0ec2715adf761afe Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 24 Dec 2024 00:12:57 +0100 Subject: [PATCH 10/20] phpstan: fix wrong args_count param for filter hook --- src/Wordpress/CustomPostType/Map.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Wordpress/CustomPostType/Map.php b/src/Wordpress/CustomPostType/Map.php index 3233c886a..c0b60cc3a 100644 --- a/src/Wordpress/CustomPostType/Map.php +++ b/src/Wordpress/CustomPostType/Map.php @@ -40,7 +40,7 @@ public function initHooks() { add_shortcode( 'cb_map', array( MapShortcode::class, 'execute' ) ); // Add actions - add_action( 'save_post_' . self::$postType, array( MapAdmin::class, 'validate_options' ), 10, 3 ); + add_action( 'save_post_' . self::$postType, array( MapAdmin::class, 'validate_options' ), 10, 1 ); add_action( 'add_meta_boxes_cb_map', array( MapAdmin::class, 'add_meta_boxes' ) ); } From a912a3d0479bbf752c6e2ccc9f7d696e84f34eb7 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 24 Dec 2024 00:13:20 +0100 Subject: [PATCH 11/20] phpstan: adds missing return phpdoc --- src/Wordpress/CustomPostType/Timeframe.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Wordpress/CustomPostType/Timeframe.php b/src/Wordpress/CustomPostType/Timeframe.php index 0282cbded..caaae53f3 100644 --- a/src/Wordpress/CustomPostType/Timeframe.php +++ b/src/Wordpress/CustomPostType/Timeframe.php @@ -1358,6 +1358,8 @@ public function setCustomColumnSortOrder( \WP_Query $query ) { /** * Initiates needed hooks. + * + * @return void */ public function initHooks() { // Add custom cmb2 type for email booking codes by cron From b561cb10bd0d09d358be8be3e3eda20c2da1ad8b Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 24 Dec 2024 00:23:17 +0100 Subject: [PATCH 12/20] phpstan: add missing types to scan --- phpstan.neon | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpstan.neon b/phpstan.neon index 8a7909aa6..835077e83 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,6 +3,8 @@ parameters: scanFiles: - commonsbooking.php - vendor/cmb2/cmb2/includes/helper-functions.php + - vendor/cmb2/cmb2/includes/CMB2_Utils.php + - vendor/cmb2/cmb2/includes/CMB2_Field.php paths: - commonsbooking.php - src/ From 4e9d2d53e564391c684dc438293f81e55f678914 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 24 Dec 2024 00:24:03 +0100 Subject: [PATCH 13/20] phpstan: deprecate method with undefined cb1 legacy function --- src/CB/CB1UserFields.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CB/CB1UserFields.php b/src/CB/CB1UserFields.php index a83eaa792..68d56cad5 100644 --- a/src/CB/CB1UserFields.php +++ b/src/CB/CB1UserFields.php @@ -227,6 +227,7 @@ public function registration_add_meta( $user_id ) { /** * Sets a flat array of user field/value pairs * + * @since 2.10 deprecated (cb_object_to_array is unspecified) * @since 0.6 * */ From d35b0c44276c3f64884d84bebf8c8fc1de04b3aa Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 24 Dec 2024 00:36:45 +0100 Subject: [PATCH 14/20] phpstan: add missing string return --- includes/Template.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/Template.php b/includes/Template.php index 7b7da8a38..d51fa5476 100644 --- a/includes/Template.php +++ b/includes/Template.php @@ -81,5 +81,6 @@ function commonsbooking_get_template_part( $slug, $name = '', $include = true, $ } else if ( $template && $include === false ) { return $before_html . $template . $after_html; } + return ''; } } From 134ad25c6bdf8f6778f7274ad8434b220ac81cb7 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 24 Dec 2024 00:37:01 +0100 Subject: [PATCH 15/20] phpstan: add missing string return/phpdoc --- src/Service/Holiday.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Service/Holiday.php b/src/Service/Holiday.php index 3358979e0..58e1220fb 100644 --- a/src/Service/Holiday.php +++ b/src/Service/Holiday.php @@ -13,7 +13,7 @@ class Holiday { * @param $object_type * @param $field_type * - * @return void + * @return string */ public static function renderFields( $field, $value, $object_id, $object_type, $field_type ) { @@ -61,6 +61,8 @@ public static function renderFields( $field, $value, $object_id, $object_type, $
_desc( true ); + + return ''; } From b98cc3b7ea2a6f63369d3ec0e269dd05bf008e41 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 24 Dec 2024 00:53:23 +0100 Subject: [PATCH 16/20] phpstan: ignore errors for now deprecated code --- phpstan.neon | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 835077e83..a2d274875 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -11,6 +11,8 @@ parameters: - includes/ level: 0 ignoreErrors: - - identifier: missingType.iterableValue - - '#Constant (COMMONSBOOKING.*|WP_DEBUG_LOG) not found.#' +# - identifier: missingType.iterableValue +# - '#Constant (COMMONSBOOKING.*|WP_DEBUG_LOG) not found.#' + - '#Instantiated class (CommonsBooking.*CB_Data) not found.#' + - '#Function cb_object_to_array not found.#' From b771e607b3ea5cd3a3144888e7d15ac82d96c175 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 24 Dec 2024 00:53:56 +0100 Subject: [PATCH 17/20] phpstan: fix wrong invocation of cron scheduling * documents scheduler code --- src/Service/Cache.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Service/Cache.php b/src/Service/Cache.php index 0c492fa74..bc6c151b6 100644 --- a/src/Service/Cache.php +++ b/src/Service/Cache.php @@ -208,14 +208,15 @@ public static function clearCache( array $tags = [] ) { * Calls clearCache using WP Cron. * Why? ClearCache can be resource intensive on larger instances and should be offloaded. * - * @param array $tags + * @param array $tags to clear cache for * * @return void */ public static function scheduleClearCache( array $tags = [] ) { - $event = wp_schedule_single_event( time(), self::$clearCacheHook, [ $tags ] ); + $event = wp_schedule_single_event( time(), self::$clearCacheHook, [ $tags ], true ); + // TODO document why only on wp-error, why this can fail, why we don't re-try or do other things, instead of forcing the execution of this resource intensive task? if ( is_wp_error( $event ) ) { - //run the event right away when scheduling fails + // runs the event right away, when scheduling fails self::clearCache( $tags ); } } From 322d6a2acb26c148f304315768ccb3ff42425ced Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 24 Dec 2024 00:59:36 +0100 Subject: [PATCH 18/20] phpstan: adds level 0 baseline * contains uncritical non-conforming action hook interface --- phpstan-baseline.neon | 6 ++++++ phpstan.neon | 2 ++ 2 files changed, 8 insertions(+) create mode 100644 phpstan-baseline.neon diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 000000000..5cbf5b993 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,6 @@ +parameters: + ignoreErrors: + - + message: "#^Action callback returns bool but should not return anything\\.$#" + count: 1 + path: src/Wordpress/CustomPostType/CustomPostType.php diff --git a/phpstan.neon b/phpstan.neon index a2d274875..18e8c80c5 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,3 +1,5 @@ +includes: + - phpstan-baseline.neon parameters: phpVersion: 70400 scanFiles: From 15b174a6ffe7b7b1e01fa1918c52c382b23524f7 Mon Sep 17 00:00:00 2001 From: Chris <105302830+datengraben@users.noreply.github.com> Date: Tue, 24 Dec 2024 01:03:21 +0100 Subject: [PATCH 19/20] Increase to level 1 --- phpstan.neon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index 18e8c80c5..f612816f7 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -11,7 +11,7 @@ parameters: - commonsbooking.php - src/ - includes/ - level: 0 + level: 1 ignoreErrors: # - identifier: missingType.iterableValue # - '#Constant (COMMONSBOOKING.*|WP_DEBUG_LOG) not found.#' From 80e5c683bcd511eabc3a2206d0d78bf2e6dd36b0 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 24 Dec 2024 01:15:03 +0100 Subject: [PATCH 20/20] phpstan: add ignore for symbols with scan-issues --- phpstan.neon | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index f612816f7..c5717c45c 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -13,8 +13,7 @@ parameters: - includes/ level: 1 ignoreErrors: -# - identifier: missingType.iterableValue -# - '#Constant (COMMONSBOOKING.*|WP_DEBUG_LOG) not found.#' + - '#Constant (COMMONSBOOKING.*|WP_DEBUG_LOG) not found.#' - '#Instantiated class (CommonsBooking.*CB_Data) not found.#' - '#Function cb_object_to_array not found.#'