From eb710e5f5dec37bc9018b2149898221a1c2948f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Fri, 22 Nov 2024 20:56:34 +0100 Subject: [PATCH] Enhancement: Add support for phpstan/phpstan:^2.0.0 --- CHANGELOG.md | 5 ++++ composer.json | 6 ++--- composer.lock | 61 +++++++++++++++++++++---------------------- phpstan-baseline.neon | 18 ++++++++++--- 4 files changed, 52 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e500f1c..c8a49950 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), For a full diff see [`2.5.0...main`][2.5.0...main]. +### Added + +- Added support for `phpstan/phpstan:^2.0.0` ([#873]), by [@localheinz] + ### Fixed - Returned rule with error identifier ([#882]), by [@localheinz] @@ -545,6 +549,7 @@ For a full diff see [`362c7ea...0.1.0`][362c7ea...0.1.0]. [#735]: https://github.com/ergebnis/phpstan-rules/pull/735 [#862]: https://github.com/ergebnis/phpstan-rules/pull/862 [#872]: https://github.com/ergebnis/phpstan-rules/pull/872 +[#873]: https://github.com/ergebnis/phpstan-rules/pull/873 [#875]: https://github.com/ergebnis/phpstan-rules/pull/875 [#877]: https://github.com/ergebnis/phpstan-rules/pull/877 [#878]: https://github.com/ergebnis/phpstan-rules/pull/878 diff --git a/composer.json b/composer.json index 25f091eb..e6c28f1e 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "require": { "php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0", "ext-mbstring": "*", - "phpstan/phpstan": "^1.10.21" + "phpstan/phpstan": "^2.0.0" }, "require-dev": { "doctrine/orm": "^2.20.0 || ^3.3.0", @@ -33,8 +33,8 @@ "ergebnis/phpunit-slow-test-detector": "^2.17.0", "nette/di": "^3.1.10", "nikic/php-parser": "^4.19.4", - "phpstan/phpstan-deprecation-rules": "^1.2.1", - "phpstan/phpstan-strict-rules": "^1.6.1", + "phpstan/phpstan-deprecation-rules": "^2.0.1", + "phpstan/phpstan-strict-rules": "^2.0.0", "phpunit/phpunit": "^9.6.21", "psr/container": "^2.0.2", "symfony/process": "^5.4.47" diff --git a/composer.lock b/composer.lock index 2088f2f7..0ac26bae 100644 --- a/composer.lock +++ b/composer.lock @@ -4,24 +4,24 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0632a3de04ffa3a44297212ff2984c46", + "content-hash": "498f7220d04a2852f326061f182e534d", "packages": [ { "name": "phpstan/phpstan", - "version": "1.12.12", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0" + "reference": "46b4d3529b12178112d9008337beda0cc2a1a6b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0", - "reference": "b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/46b4d3529b12178112d9008337beda0cc2a1a6b4", + "reference": "46b4d3529b12178112d9008337beda0cc2a1a6b4", "shasum": "" }, "require": { - "php": "^7.2|^8.0" + "php": "^7.4|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -62,7 +62,7 @@ "type": "github" } ], - "time": "2024-11-28T22:13:23+00:00" + "time": "2024-11-28T22:19:37+00:00" } ], "packages-dev": [ @@ -3328,26 +3328,26 @@ }, { "name": "phpstan/phpstan-deprecation-rules", - "version": "1.2.1", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-deprecation-rules.git", - "reference": "f94d246cc143ec5a23da868f8f7e1393b50eaa82" + "reference": "1cc1259cb91ee4cfbb5c39bca9f635f067c910b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/f94d246cc143ec5a23da868f8f7e1393b50eaa82", - "reference": "f94d246cc143ec5a23da868f8f7e1393b50eaa82", + "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/1cc1259cb91ee4cfbb5c39bca9f635f067c910b4", + "reference": "1cc1259cb91ee4cfbb5c39bca9f635f067c910b4", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.12" + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.0" }, "require-dev": { "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.5" + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^9.6" }, "type": "phpstan-extension", "extra": { @@ -3369,34 +3369,33 @@ "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", "support": { "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", - "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.2.1" + "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/2.0.1" }, - "time": "2024-09-11T15:52:35+00:00" + "time": "2024-11-28T21:56:36+00:00" }, { "name": "phpstan/phpstan-strict-rules", - "version": "1.6.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-strict-rules.git", - "reference": "daeec748b53de80a97498462513066834ec28f8b" + "reference": "a4a6a08bd4a461e516b9c3b8fdbf0f1883b34158" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/daeec748b53de80a97498462513066834ec28f8b", - "reference": "daeec748b53de80a97498462513066834ec28f8b", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/a4a6a08bd4a461e516b9c3b8fdbf0f1883b34158", + "reference": "a4a6a08bd4a461e516b9c3b8fdbf0f1883b34158", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.12.4" + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.0" }, "require-dev": { - "nikic/php-parser": "^4.13.0", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-deprecation-rules": "^1.1", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.5" + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^9.6" }, "type": "phpstan-extension", "extra": { @@ -3418,9 +3417,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/1.6.1" + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.0" }, - "time": "2024-09-20T14:04:44+00:00" + "time": "2024-10-26T16:04:33+00:00" }, { "name": "phpunit/php-code-coverage", @@ -7007,14 +7006,14 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { "php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0", "ext-mbstring": "*" }, - "platform-dev": [], + "platform-dev": {}, "platform-overrides": { "php": "7.4.33" }, diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e2e011fd..0ad2b357 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,22 +1,32 @@ parameters: ignoreErrors: - - message: "#^Language construct isset\\(\\) should not be used\\.$#" + message: '#^Language construct isset\(\) should not be used\.$#' + identifier: ergebnis.noIsset count: 1 path: src/Classes/FinalRule.php - - message: "#^Language construct isset\\(\\) should not be used\\.$#" + message: '#^Language construct isset\(\) should not be used\.$#' + identifier: ergebnis.noIsset count: 1 path: src/Classes/NoExtendsRule.php - - message: "#^Language construct isset\\(\\) should not be used\\.$#" + message: '#^Language construct isset\(\) should not be used\.$#' + identifier: ergebnis.noIsset count: 1 path: src/Classes/PHPUnit/Framework/TestCaseWithSuffixRule.php - - message: "#^Language construct isset\\(\\) should not be used\\.$#" + message: '#^Language construct isset\(\) should not be used\.$#' + identifier: ergebnis.noIsset count: 1 path: src/Functions/NoNullableReturnTypeDeclarationRule.php + - + message: '#^Method Ergebnis\\PHPStan\\Rules\\Methods\\NoParameterWithContainerTypeDeclarationRule\:\:processNode\(\) should return list\ but returns list\.$#' + identifier: return.type + count: 1 + path: src/Methods/NoParameterWithContainerTypeDeclarationRule.php +