Repository navigation
chore: add PHPStan deprecation rules - #78
Merged
Merged
Conversation
Add phpstan/phpstan-deprecation-rules. Put the 20 #[ApiFilter] deprecations (API Platform 4.4) in the baseline, because the change to #[QueryParameter] needs application code changes. CI now finds new deprecations.
Use an ignoreErrors rule in phpstan.dist.neon instead of baseline entries, so the reason is documented.
Open
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #78 +/- ##
==========================================
Coverage 74.39% 74.39%
Complexity 264 264
==========================================
Files 30 30
Lines 738 738
==========================================
Hits 549 549
Misses 189 189
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add PHPStan deprecation rules, and ignore the API Platform 4.4
#[ApiFilter]deprecations with a commented rule. This is step 8 of the quarterly update.Changes
phpstan/phpstan-deprecation-rules(^2.0) torequire-dev.ignoreErrorsrule with a comment tophpstan.dist.neon. It ignoresattribute.deprecatedforApiPlatform\Metadata\ApiFilterinsrc/Api/Dto/*only (20 findings in 7 DTOs).phpstan-baseline.neondoes not change.Why
The tests find only deprecations that occur at runtime. A class with only a
@deprecateddocblock does not trigger a deprecation. The deprecation rules let PHPStan find these, and CI now fails on new deprecations.PHPStan finds only the
#[ApiFilter]deprecation. 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 7 DTOs, andAbstractProvider::getFilters(), which reads the#[ApiFilter]attributes throughapi_platform.filter_locator. The quarterly update includes only deprecations that Rector fixes or that are easy.The ignore rule is in
phpstan.dist.neonand not in the baseline, so the comment explains the reason and tells when to remove the rule. The rule matches only theApiFiltermessage insrc/Api/Dto/*, so PHPStan still reports all other deprecations.bin/console debug:container --deprecationsshows the same 20 deprecations at container compile time.Checks before the release
composer audit: no advisories.composer outdated --direct --minor-only: only versions that are still in the cooldown remain (api-platform/core4.4.7,friendsofphp/php-cs-fixer3.95.29,phpstan/phpstan2.3.5,phpstan/phpstan-strict-rules2.1.1,rector/rector2.8.4).composer recipes --outdated: no outdated recipes.composer normalize: no changes.