From 9718e8eb81dab3272261acd956904594b6956d25 Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Tue, 6 Oct 2026 20:56:12 +0200 Subject: [PATCH] Update PHPStan to 2.3 PHPStan 1.12 to 2.3, with szepeviktor/phpstan-wordpress 1.3 to 2.0 (which brings WordPress stubs 6.9 to 7.1). The code needed no changes. Two config entries did: - excludePaths: tests does not exist in this repository, which PHPStan 2 refuses; marked optional as tests (?). - The ignore for missingType.generics matched nothing on PHPStan 2 and is reported as unused; removed. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Filip Ilic --- composer.json | 4 +- composer.lock | 150 +++++++++++++--------------------------------- phpstan.neon.dist | 4 +- 3 files changed, 44 insertions(+), 114 deletions(-) diff --git a/composer.json b/composer.json index 8ee7555..c1643cc 100644 --- a/composer.json +++ b/composer.json @@ -13,8 +13,8 @@ "php-parallel-lint/php-parallel-lint": "^1.3", "phpcompatibility/phpcompatibility-wp": "^2.1", "wp-coding-standards/wpcs": "^3.0", - "phpstan/phpstan": "^1.10", - "szepeviktor/phpstan-wordpress": "^1.3", + "phpstan/phpstan": "^2.0", + "szepeviktor/phpstan-wordpress": "^2.0", "phpstan/extension-installer": "^1.3", "phpcompatibility/php-compatibility": "^9.3" }, diff --git a/composer.lock b/composer.lock index 13d23a0..4eeceb4 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": "68e73cf23844dd66f4d8b3b14eef46cd", + "content-hash": "49309948e892429c2a9f26b0e665194e", "packages": [], "packages-dev": [ { @@ -166,16 +166,16 @@ }, { "name": "php-stubs/wordpress-stubs", - "version": "v6.9.0", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/php-stubs/wordpress-stubs.git", - "reference": "5171cb6650e6c583a96943fd6ea0dfa3e1089a8a" + "reference": "6926c5156431a3ff909d43faa16a92a0bc0c2428" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/5171cb6650e6c583a96943fd6ea0dfa3e1089a8a", - "reference": "5171cb6650e6c583a96943fd6ea0dfa3e1089a8a", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/6926c5156431a3ff909d43faa16a92a0bc0c2428", + "reference": "6926c5156431a3ff909d43faa16a92a0bc0c2428", "shasum": "" }, "conflict": { @@ -185,12 +185,13 @@ "dealerdirect/phpcodesniffer-composer-installer": "^1.0", "nikic/php-parser": "^5.5", "php": "^7.4 || ^8.0", - "php-stubs/generator": "^0.8.3", - "phpdocumentor/reflection-docblock": "^5.4.1", - "phpstan/phpstan": "^2.1", + "php-stubs/generator": "^0.9", + "phpdocumentor/reflection-docblock": "^6.0", + "phpstan/phpstan": "^2.2", "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" + "symfony/polyfill-php80": "*", + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.2", + "wp-coding-standards/wpcs": "3.4.1 as 2.3.0" }, "suggest": { "paragonie/sodium_compat": "Pure PHP implementation of libsodium", @@ -211,9 +212,9 @@ ], "support": { "issues": "https://github.com/php-stubs/wordpress-stubs/issues", - "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.9.0" + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v7.1.2" }, - "time": "2025-12-03T23:06:24+00:00" + "time": "2026-10-06T06:59:21+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -653,15 +654,15 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.32", + "version": "2.3.0", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/2770dcdf5078d0b0d53f94317e06affe88419aa8", - "reference": "2770dcdf5078d0b0d53f94317e06affe88419aa8", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b1f9890d9af53a25c58129e78f0aadd31f90d7f4", + "reference": "b1f9890d9af53a25c58129e78f0aadd31f90d7f4", "shasum": "" }, "require": { - "php": "^7.2|^8.0" + "php": "^7.4|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -680,6 +681,17 @@ "license": [ "MIT" ], + "authors": [ + { + "name": "Ondřej Mirtes" + }, + { + "name": "Markus Staab" + }, + { + "name": "Vincent Langlet" + } + ], "description": "PHPStan - PHP Static Analysis Tool", "keywords": [ "dev", @@ -702,7 +714,7 @@ "type": "github" } ], - "time": "2025-09-30T10:16:31+00:00" + "time": "2026-10-06T06:15:36+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -783,112 +795,32 @@ ], "time": "2025-11-04T16:30:35+00:00" }, - { - "name": "symfony/polyfill-php73", - "version": "v1.33.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb", - "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.33.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-09-09T11:45:10+00:00" - }, { "name": "szepeviktor/phpstan-wordpress", - "version": "v1.3.5", + "version": "v2.0.4", "source": { "type": "git", "url": "https://github.com/szepeviktor/phpstan-wordpress.git", - "reference": "7f8cfe992faa96b6a33bbd75c7bace98864161e7" + "reference": "84577e2ea1e4c2a95537fe5ea2ac8e18f4ceab1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/7f8cfe992faa96b6a33bbd75c7bace98864161e7", - "reference": "7f8cfe992faa96b6a33bbd75c7bace98864161e7", + "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/84577e2ea1e4c2a95537fe5ea2ac8e18f4ceab1a", + "reference": "84577e2ea1e4c2a95537fe5ea2ac8e18f4ceab1a", "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" + "php": "^7.4 || ^8.0", + "php-stubs/wordpress-stubs": ">=6.6.2", + "phpstan/phpstan": "^2.0" }, "require-dev": { "composer/composer": "^2.1.14", + "composer/semver": "^3.4", "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", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.0", "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.0", "wp-coding-standards/wpcs": "3.1.0 as 2.3.0" }, @@ -922,9 +854,9 @@ ], "support": { "issues": "https://github.com/szepeviktor/phpstan-wordpress/issues", - "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.3.5" + "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v2.0.4" }, - "time": "2024-06-28T22:27:19+00:00" + "time": "2026-05-22T16:22:09+00:00" }, { "name": "wp-coding-standards/wpcs", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 769aa5e..02967f1 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -4,6 +4,4 @@ parameters: - . excludePaths: - vendor - - tests - ignoreErrors: - - identifier: missingType.generics + - tests (?)