From 012e23a3f3c5db6e90f86470e18739f42ba46871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Sun, 5 Oct 2025 14:49:01 +0200 Subject: [PATCH 1/3] Upgrade to PHPStan 2 --- composer.json | 4 +- composer.lock | 317 ++++++++++++++++++++++++++------------------------ phpstan.neon | 7 +- 3 files changed, 168 insertions(+), 160 deletions(-) diff --git a/composer.json b/composer.json index d7c3b3f..8b23469 100644 --- a/composer.json +++ b/composer.json @@ -10,8 +10,8 @@ "dragonmantank/cron-expression": "^3.1" }, "require-dev": { - "phpstan/phpstan": "^0.12.83", - "phpstan/phpstan-strict-rules": "^0.12.9", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-strict-rules": "^2.0", "squizlabs/php_codesniffer": "^4.0" }, "autoload": { diff --git a/composer.lock b/composer.lock index 4748ebf..705e29f 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": "268d40e59b1025e7a2ef6cb408e384aa", + "content-hash": "7d474e341f86275fb96393a7f2972a80", "packages": [ { "name": "dragonmantank/cron-expression", @@ -398,22 +398,27 @@ }, { "name": "psr/container", - "version": "1.1.2", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -440,9 +445,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-11-05T16:50:12+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { "name": "psr/http-client", @@ -650,16 +655,16 @@ }, { "name": "symfony/console", - "version": "v5.4.34", + "version": "v5.4.47", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "4b4d8cd118484aa604ec519062113dd87abde18c" + "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/4b4d8cd118484aa604ec519062113dd87abde18c", - "reference": "4b4d8cd118484aa604ec519062113dd87abde18c", + "url": "https://api.github.com/repos/symfony/console/zipball/c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed", + "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed", "shasum": "" }, "require": { @@ -729,7 +734,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.34" + "source": "https://github.com/symfony/console/tree/v5.4.47" }, "funding": [ { @@ -745,24 +750,24 @@ "type": "tidelift" } ], - "time": "2023-12-08T13:33:03+00:00" + "time": "2024-11-06T11:30:55+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.4", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918" + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918", - "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1" }, "type": "library", "extra": { @@ -771,7 +776,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.6-dev" } }, "autoload": { @@ -796,7 +801,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.4" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" }, "funding": [ { @@ -812,11 +817,11 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:11:13+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.31.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -875,7 +880,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.33.0" }, "funding": [ { @@ -886,6 +891,10 @@ "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" @@ -895,32 +904,29 @@ }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.28.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "875e90aeea2777b6f135677f618529449334a612" + "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", - "reference": "875e90aeea2777b6f135677f618529449334a612", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/380872130d3a5dd3ace2f4010d95125fde5d5c70", + "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -956,7 +962,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.33.0" }, "funding": [ { @@ -967,41 +973,42 @@ "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": "2023-01-26T09:26:14+00:00" + "time": "2025-06-27T09:58:17+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.28.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" + "reference": "3833d7255cc303546435cb650316bff708a1c75c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", - "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1040,7 +1047,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.33.0" }, "funding": [ { @@ -1051,29 +1058,34 @@ "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": "2023-01-26T09:26:14+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", "shasum": "" }, "require": { - "php": ">=7.1" + "ext-iconv": "*", + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -1083,12 +1095,9 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1123,7 +1132,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.33.0" }, "funding": [ { @@ -1134,38 +1143,39 @@ "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": "2023-07-28T09:04:16+00:00" + "time": "2024-12-23T08:48:59+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.28.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb", + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1202,7 +1212,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.33.0" }, "funding": [ { @@ -1213,38 +1223,39 @@ "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": "2023-01-26T09:26:14+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.28.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608", + "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1285,7 +1296,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.33.0" }, "funding": [ { @@ -1296,52 +1307,56 @@ "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": "2023-01-26T09:26:14+00:00" + "time": "2025-01-02T08:10:11+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.5.2", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f021b05a130d35510bd6b25fe9053c2a8a15d5d4", + "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1", - "symfony/deprecation-contracts": "^2.1|^3" + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" }, "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "2.5-dev" - }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" } }, "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1368,7 +1383,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/service-contracts/tree/v3.6.0" }, "funding": [ { @@ -1384,38 +1399,37 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:17:29+00:00" + "time": "2025-04-25T09:37:31+00:00" }, { "name": "symfony/string", - "version": "v5.4.34", + "version": "v6.4.26", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "e3f98bfc7885c957488f443df82d97814a3ce061" + "reference": "5621f039a71a11c87c106c1c598bdcd04a19aeea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/e3f98bfc7885c957488f443df82d97814a3ce061", - "reference": "e3f98bfc7885c957488f443df82d97814a3ce061", + "url": "https://api.github.com/repos/symfony/string/zipball/5621f039a71a11c87c106c1c598bdcd04a19aeea", + "reference": "5621f039a71a11c87c106c1c598bdcd04a19aeea", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": ">=3.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0|^6.0", - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0|^6.0" + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/intl": "^6.2|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -1454,7 +1468,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.34" + "source": "https://github.com/symfony/string/tree/v6.4.26" }, "funding": [ { @@ -1465,25 +1479,29 @@ "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": "2023-12-09T13:20:28+00:00" + "time": "2025-09-11T14:32:46+00:00" }, { "name": "symfony/yaml", - "version": "v5.4.40", + "version": "v5.4.45", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "81cad0ceab3d61fe14fe941ff18a230ac9c80f83" + "reference": "a454d47278cc16a5db371fe73ae66a78a633371e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/81cad0ceab3d61fe14fe941ff18a230ac9c80f83", - "reference": "81cad0ceab3d61fe14fe941ff18a230ac9c80f83", + "url": "https://api.github.com/repos/symfony/yaml/zipball/a454d47278cc16a5db371fe73ae66a78a633371e", + "reference": "a454d47278cc16a5db371fe73ae66a78a633371e", "shasum": "" }, "require": { @@ -1529,7 +1547,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.4.40" + "source": "https://github.com/symfony/yaml/tree/v5.4.45" }, "funding": [ { @@ -1545,7 +1563,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:33:22+00:00" + "time": "2024-09-25T14:11:13+00:00" }, { "name": "webmozart/assert", @@ -1609,20 +1627,15 @@ "packages-dev": [ { "name": "phpstan/phpstan", - "version": "0.12.100", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan.git", - "reference": "48236ddf823547081b2b153d1cd2994b784328c3" - }, + "version": "2.1.30", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/48236ddf823547081b2b153d1cd2994b784328c3", - "reference": "48236ddf823547081b2b153d1cd2994b784328c3", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a4a7f159927983dd4f7c8020ed227d80b7f39d7d", + "reference": "a4a7f159927983dd4f7c8020ed227d80b7f39d7d", "shasum": "" }, "require": { - "php": "^7.1|^8.0" + "php": "^7.4|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -1632,11 +1645,6 @@ "phpstan.phar" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.12-dev" - } - }, "autoload": { "files": [ "bootstrap.php" @@ -1647,9 +1655,16 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.100" + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" }, "funding": [ { @@ -1659,42 +1674,36 @@ { "url": "https://github.com/phpstan", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", - "type": "tidelift" } ], - "time": "2022-11-01T09:52:08+00:00" + "time": "2025-10-02T16:07:52+00:00" }, { "name": "phpstan/phpstan-strict-rules", - "version": "0.12.11", + "version": "2.0.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-strict-rules.git", - "reference": "2b72e8e17d2034145f239126e876e5fb659675e2" + "reference": "d6211c46213d4181054b3d77b10a5c5cb0d59538" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/2b72e8e17d2034145f239126e876e5fb659675e2", - "reference": "2b72e8e17d2034145f239126e876e5fb659675e2", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/d6211c46213d4181054b3d77b10a5c5cb0d59538", + "reference": "d6211c46213d4181054b3d77b10a5c5cb0d59538", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0", - "phpstan/phpstan": "^0.12.96" + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.1.29" }, "require-dev": { "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-phpunit": "^0.12.16", - "phpunit/phpunit": "^9.5" + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^9.6" }, "type": "phpstan-extension", "extra": { - "branch-alias": { - "dev-master": "0.12-dev" - }, "phpstan": { "includes": [ "rules.neon" @@ -1713,9 +1722,9 @@ "description": "Extra strict and opinionated rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", - "source": "https://github.com/phpstan/phpstan-strict-rules/tree/0.12.11" + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.7" }, - "time": "2021-08-21T11:36:27+00:00" + "time": "2025-09-26T11:19:08+00:00" }, { "name": "squizlabs/php_codesniffer", diff --git a/phpstan.neon b/phpstan.neon index bb37d27..98e5a72 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -8,9 +8,8 @@ parameters: - process.php fileExtensions: - php - level: max + level: 8 reportUnmatchedIgnoredErrors: true - # checkGenericClassInNonGenericObjectType: false - checkMissingIterableValueType: false + reportMaybesInPropertyPhpDocTypes: false ignoreErrors: - - '#Method App\\Command\\AbstractCommand::execute\(\) should return int but return statement is missing.#' + - identifier: missingType.iterableValue From 4d071c3f50c8184d3cb1dbd01bca78a73cf27c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Sun, 5 Oct 2025 14:49:15 +0200 Subject: [PATCH 2/3] Apply PHPStan fixes --- Command/AbstractCommand.php | 2 ++ Command/GeoJSONCommand.php | 52 ++++++++++++++++++------------------- Command/WikidataCommand.php | 6 ++--- Wikidata/Wikidata.php | 26 +++++++++---------- 4 files changed, 44 insertions(+), 42 deletions(-) diff --git a/Command/AbstractCommand.php b/Command/AbstractCommand.php index 239ade7..20c6c0b 100644 --- a/Command/AbstractCommand.php +++ b/Command/AbstractCommand.php @@ -135,5 +135,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // Read configuration. $configArray = require $configPath; $this->config = new Config($configArray); + + return Command::SUCCESS; } } diff --git a/Command/GeoJSONCommand.php b/Command/GeoJSONCommand.php index 13580a9..5c89835 100644 --- a/Command/GeoJSONCommand.php +++ b/Command/GeoJSONCommand.php @@ -257,7 +257,7 @@ private function extractDetailsFromWikidata($entity, array &$warnings = []): Det * Extract details from CSV file. * * @param Element $object OpenStreetMap element (relation/way/node). - * @param array $warnings + * @param string[] $warnings * @return null|Details */ private function extractDetailsFromCSV($object, array &$warnings = []): ?Details @@ -331,22 +331,22 @@ private function getGenderFromConfig($object, array &$warnings = []): ?string * @param string[] $warnings * @return null|string */ - private function getGenderFromEvent($object, array &$warnings = []): ?string - { - if (!isset($this->event) || count($this->event) === 0) { - return null; - } - - if (isset($object->tags->{'name:fr'}, $this->event[md5($object->tags->{'name:fr'})])) { // @phpstan-ignore-line - return $this->event[md5($object->tags->{'name:fr'})]; // @phpstan-ignore-line - } elseif (isset($object->tags->{'name:nl'}, $this->event[md5($object->tags->{'name:nl'})])) { // @phpstan-ignore-line - return $this->event[md5($object->tags->{'name:nl'})]; // @phpstan-ignore-line - } elseif (isset($object->tags->{'name'}, $this->event[md5($object->tags->{'name'})])) { // @phpstan-ignore-line - return $this->event[md5($object->tags->{'name'})]; // @phpstan-ignore-line - } - - return null; - } + // private function getGenderFromEvent($object, array &$warnings = []): ?string + // { + // if (!isset($this->event) || count($this->event) === 0) { + // return null; + // } + + // if (isset($object->tags->{'name:fr'}, $this->event[md5($object->tags->{'name:fr'})])) { + // return $this->event[md5($object->tags->{'name:fr'})]; + // } elseif (isset($object->tags->{'name:nl'}, $this->event[md5($object->tags->{'name:nl'})])) { + // return $this->event[md5($object->tags->{'name:nl'})]; + // } elseif (isset($object->tags->{'name'}, $this->event[md5($object->tags->{'name'})])) { + // return $this->event[md5($object->tags->{'name'})]; + // } + + // return null; + // } /** * Create GeoJSON feature "property". @@ -361,15 +361,15 @@ private function getGenderFromEvent($object, array &$warnings = []): ?string private function createProperties($object, array &$warnings = []): Properties { $properties = new Properties(); - $properties->name = $object->tags->name ?? null; // @phpstan-ignore-line - $properties->wikidata = $object->tags->wikidata ?? null; // @phpstan-ignore-line + $properties->name = $object->tags->name ?? null; // @phpstan-ignore property.notFound + $properties->wikidata = $object->tags->wikidata ?? null; // @phpstan-ignore property.notFound $properties->source = null; $properties->gender = null; $properties->details = null; // Try to extract information from `name:etymology:wikidata` tag in OpenStreetMap - if (isset($object->tags->{'name:etymology:wikidata'})) { // @phpstan-ignore-line - $idsEtymology = explode(';', $object->tags->{'name:etymology:wikidata'}); // @phpstan-ignore-line + if (isset($object->tags->{'name:etymology:wikidata'})) { // @phpstan-ignore property.notFound,property.dynamicName + $idsEtymology = explode(';', $object->tags->{'name:etymology:wikidata'}); // @phpstan-ignore property.dynamicName $idsEtymology = array_map('trim', $idsEtymology); $detailsEtymology = []; @@ -403,7 +403,7 @@ private function createProperties($object, array &$warnings = []): Properties } // Try to extract information from `P138` (NamedAfter) property in Wikidata - if (isset($object->tags->wikidata)) { + if (isset($object->tags->wikidata)) { // @phpstan-ignore property.notFound if (preg_match('/^Q[0-9]+$/', $object->tags->wikidata) !== 1) { $warnings[] = sprintf('Format of `wikidata` is invalid (%s) for %s(%d).', $object->tags->wikidata, $object->type, $object->id); } else { @@ -475,12 +475,12 @@ private function createProperties($object, array &$warnings = []): Properties if (isset($genderEtymology, $detailsEtymology)) { // If `name:etymology:wikidata` tag is set, use it to extract details and determine gender. $properties->source = 'wikidata'; - $properties->gender = $genderEtymology ? $genderEtymology : null; + $properties->gender = $genderEtymology; $properties->details = $detailsEtymology; } elseif (isset($genderWikidata, $detailsWikidata)) { // If `P138` (NamedAfter) property is set, use it to extract details and determine gender. $properties->source = 'wikidata'; - $properties->gender = $genderWikidata ? $genderWikidata : null; + $properties->gender = $genderWikidata; $properties->details = $detailsWikidata; } elseif (!is_null($details = $this->extractDetailsFromCSV($object, $warnings))) { // If relation/way is defined in CSV file, use it to extract details and determine gender. @@ -518,7 +518,7 @@ private static function createGeometry($object, array $relations, array $ways, a /** @var Relation */ $object = $object; /** @var Member[] */ $members = []; - switch ($object->tags->type) { + switch ($object->tags->type) { // @phpstan-ignore property.nonObject case 'associatedStreet': case 'street': $members = array_filter( @@ -554,7 +554,7 @@ function ($member): bool { } break; default: - $warnings[] = sprintf('Type "%s" is not supported (yet) for relation(%d).', $object->tags->type, $object->id); + $warnings[] = sprintf('Type "%s" is not supported (yet) for relation(%d).', $object->tags->type, $object->id); // @phpstan-ignore property.nonObject break; } diff --git a/Command/WikidataCommand.php b/Command/WikidataCommand.php index 2e64a04..82ac5e6 100644 --- a/Command/WikidataCommand.php +++ b/Command/WikidataCommand.php @@ -76,7 +76,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int array_merge($overpassR->elements ?? [], $overpassW->elements ?? []), function ($element): bool { return isset($element->tags) && - (isset($element->tags->wikidata) || isset($element->tags->{'name:etymology:wikidata'})); // @phpstan-ignore-line + (isset($element->tags->wikidata) || isset($element->tags->{'name:etymology:wikidata'})); // @phpstan-ignore property.notFound,property.notFound,property.dynamicName } ); @@ -98,9 +98,9 @@ function ($element): bool { foreach ($elements as $element) { /** @var string|null */ - $wikidataTag = $element->tags->wikidata ?? null; // @phpstan-ignore-line + $wikidataTag = $element->tags->wikidata ?? null; // @phpstan-ignore property.notFound /** @var string|null */ - $etymologyTag = $element->tags->{'name:etymology:wikidata'} ?? null; // @phpstan-ignore-line + $etymologyTag = $element->tags->{'name:etymology:wikidata'} ?? null; // @phpstan-ignore property.notFound,property.dynamicName // Download Wikidata item(s) defined in `name:etymology:wikidata` tag if (!is_null($etymologyTag) && $etymologyTag !== $wikidataTag) { diff --git a/Wikidata/Wikidata.php b/Wikidata/Wikidata.php index 6afbae6..47dc1b5 100644 --- a/Wikidata/Wikidata.php +++ b/Wikidata/Wikidata.php @@ -42,7 +42,7 @@ public static function extractLabels($entity, array $languages): array $labels = []; foreach ($languages as $language) { - $label = $entity->labels->{$language} ?? $entity->labels->mul ?? null; // @phpstan-ignore-line + $label = $entity->labels->{$language} ?? $entity->labels->mul ?? null; // @phpstan-ignore property.notFound,property.dynamicName if ($label !== null) { $labels[$language] = $label; } @@ -62,8 +62,8 @@ public static function extractDescriptions($entity, array $languages): array $descriptions = []; foreach ($languages as $language) { - if (isset($entity->descriptions->{$language})) { // @phpstan-ignore-line - $descriptions[$language] = $entity->descriptions->{$language}; // @phpstan-ignore-line + if (isset($entity->descriptions->{$language})) { // @phpstan-ignore property.dynamicName + $descriptions[$language] = $entity->descriptions->{$language}; // @phpstan-ignore property.dynamicName } } @@ -81,8 +81,8 @@ public static function extractSitelinks($entity, array $languages): array $sitelinks = []; foreach ($languages as $language) { - if (isset($entity->sitelinks->{$language . 'wiki'})) { // @phpstan-ignore-line - $sitelinks[$language . 'wiki'] = $entity->sitelinks->{$language . 'wiki'}; // @phpstan-ignore-line + if (isset($entity->sitelinks->{$language . 'wiki'})) { // @phpstan-ignore property.dynamicName + $sitelinks[$language . 'wiki'] = $entity->sitelinks->{$language . 'wiki'}; // @phpstan-ignore property.dynamicName } } @@ -103,7 +103,7 @@ public static function extractNicknames($entity, array $languages): ?array foreach ($claims as $value) { /** @var \stdClass */ - $mainValue = $value->mainsnak->datavalue->value; // @phpstan-ignore-line + $mainValue = $value->mainsnak->datavalue->value; // @phpstan-ignore property.notFound $language = $mainValue->language; if (in_array($language, $languages, true)) { @@ -127,13 +127,13 @@ public static function extractNamedAfter($entity): ?array $claims = $entity->claims->P138 ?? []; foreach ($claims as $value) { - $endTime = $value->qualifiers->P582[0]->datavalue->value->time ?? null; // @phpstan-ignore-line + $endTime = $value->qualifiers->P582[0]->datavalue->value->time ?? null; // @phpstan-ignore property.notFound if (!is_null($endTime) && $endTime < date('c')) { continue; } /** @var string */ - $id = $value->mainsnak->datavalue->value->id; // @phpstan-ignore-line + $id = $value->mainsnak->datavalue->value->id; // @phpstan-ignore property.notFound $identifiers[] = $id; } @@ -146,7 +146,7 @@ public static function extractNamedAfter($entity): ?array */ public static function extractDateOfBirth($entity): ?string { - return isset($entity->claims->P569) ? $entity->claims->P569[0]->mainsnak->datavalue->value->time ?? null : null; // @phpstan-ignore-line + return isset($entity->claims->P569) ? $entity->claims->P569[0]->mainsnak->datavalue->value->time ?? null : null; // @phpstan-ignore property.notFound } /** @@ -154,7 +154,7 @@ public static function extractDateOfBirth($entity): ?string */ public static function extractDateOfDeath($entity): ?string { - return isset($entity->claims->P570) ? $entity->claims->P570[0]->mainsnak->datavalue->value->time ?? null : null; // @phpstan-ignore-line + return isset($entity->claims->P570) ? $entity->claims->P570[0]->mainsnak->datavalue->value->time ?? null : null; // @phpstan-ignore property.notFound } /** @@ -162,7 +162,7 @@ public static function extractDateOfDeath($entity): ?string */ public static function extractImage($entity): ?string { - return isset($entity->claims->P18) ? $entity->claims->P18[0]->mainsnak->datavalue->value ?? null : null; // @phpstan-ignore-line + return isset($entity->claims->P18) ? $entity->claims->P18[0]->mainsnak->datavalue->value ?? null : null; // @phpstan-ignore property.notFound } /** @@ -170,7 +170,7 @@ public static function extractImage($entity): ?string */ public static function extractGender($entity): ?string { - $identifier = isset($entity->claims->P21) ? $entity->claims->P21[0]->mainsnak->datavalue->value->id ?? null : null; // @phpstan-ignore-line + $identifier = isset($entity->claims->P21) ? $entity->claims->P21[0]->mainsnak->datavalue->value->id ?? null : null; // @phpstan-ignore property.notFound switch ($identifier) { case 'Q6581097': // male @@ -212,7 +212,7 @@ private static function extractInstances($entity): ?array } return array_map(function ($p) { - return $p->mainsnak->datavalue->value->id; // @phpstan-ignore-line + return $p->mainsnak->datavalue->value->id; // @phpstan-ignore property.notFound }, $property); } From 7acdb35814ad42bace9165f76a6030779f005607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Sun, 5 Oct 2025 15:01:16 +0200 Subject: [PATCH 3/3] Apply Copilot suggestions --- Command/GeoJSONCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Command/GeoJSONCommand.php b/Command/GeoJSONCommand.php index 5c89835..9d230bc 100644 --- a/Command/GeoJSONCommand.php +++ b/Command/GeoJSONCommand.php @@ -475,12 +475,12 @@ private function createProperties($object, array &$warnings = []): Properties if (isset($genderEtymology, $detailsEtymology)) { // If `name:etymology:wikidata` tag is set, use it to extract details and determine gender. $properties->source = 'wikidata'; - $properties->gender = $genderEtymology; + $properties->gender = $genderEtymology ? $genderEtymology : null; // @phpstan-ignore ternary.condNotBoolean $properties->details = $detailsEtymology; } elseif (isset($genderWikidata, $detailsWikidata)) { // If `P138` (NamedAfter) property is set, use it to extract details and determine gender. $properties->source = 'wikidata'; - $properties->gender = $genderWikidata; + $properties->gender = $genderWikidata ? $genderWikidata : null; // @phpstan-ignore ternary.condNotBoolean $properties->details = $detailsWikidata; } elseif (!is_null($details = $this->extractDetailsFromCSV($object, $warnings))) { // If relation/way is defined in CSV file, use it to extract details and determine gender.