diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a4c7ab..41af545 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ See [keep a changelog] for information about writing changes to this log. ## [Unreleased] +- [PR-78](https://github.com/itk-dev/event-database-api/pull/78) + Add PHPStan deprecation rules (ignore the API Platform 4.4 `#[ApiFilter]` deprecations) - [PR-77](https://github.com/itk-dev/event-database-api/pull/77) Update Symfony Flex recipes - [PR-76](https://github.com/itk-dev/event-database-api/pull/76) diff --git a/composer.json b/composer.json index 390b0d0..c665983 100644 --- a/composer.json +++ b/composer.json @@ -45,6 +45,7 @@ "pb30/phpstan-composer-analysis": "^1.1", "phpstan/extension-installer": "^1.4", "phpstan/phpstan": "^2.1", + "phpstan/phpstan-deprecation-rules": "^2.0", "phpstan/phpstan-strict-rules": "^2.0", "phpstan/phpstan-symfony": "^2.0", "phpunit/phpunit": "^13", diff --git a/composer.lock b/composer.lock index f60651e..a22f967 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": "0b8b0e658b7dce17f6848b7f79e34c48", + "content-hash": "9191b2f4b520ad3382f47d428fa5f251", "packages": [ { "name": "api-platform/core", @@ -8183,6 +8183,58 @@ "time": "2026-10-28T22:38:53+00:00", "published-time": "2026-10-28T22:39:06+00:00" }, + { + "name": "phpstan/phpstan-deprecation-rules", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-deprecation-rules.git", + "reference": "67bedd65c24bc72840afc45aed48b1059dd44bec" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/67bedd65c24bc72840afc45aed48b1059dd44bec", + "reference": "67bedd65c24bc72840afc45aed48b1059dd44bec", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.1.39" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^9.6", + "shipmonk/name-collision-detector": "^2.1" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", + "keywords": [ + "static analysis" + ], + "support": { + "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", + "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/2.0.5" + }, + "time": "2026-07-22T06:50:43+00:00", + "published-time": "2026-07-27T15:18:00+00:00" + }, { "name": "phpstan/phpstan-strict-rules", "version": "2.1.0", diff --git a/phpstan.dist.neon b/phpstan.dist.neon index d48207b..0ec6d37 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -17,6 +17,13 @@ parameters: - identifier: missingType.iterableValue # The ID properties are set reflectively by API Platform. - '#Property App\\Api\\Dto\\[^\\]+::\$id is unused#' + # API Platform 4.4 deprecates #[ApiFilter] and replaces it with #[QueryParameter]. #[ApiFilter] is removed + # in API Platform 6.0. The change needs application code changes (the DTOs, and AbstractProvider::getFilters(), + # which reads the #[ApiFilter] attributes through api_platform.filter_locator). Remove this rule after the change. + - + identifier: attribute.deprecated + message: '#^Attribute class ApiPlatform\\Metadata\\ApiFilter is deprecated#' + path: src/Api/Dto/* # pb30/phpstan-composer-analysis: report packages used directly but only installed transitively ("shadow # dependencies") and dev packages used in production code. Unused/misplaced checks are off: bundles and # extensions are used through config, not class references, so they would all be false positives.