Closes #7150: Add tests for Ensure Docblock presence for wpm_apply_filters_typed() rule #7156
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.
Description
Fixes #7150
No impact.
Type of change
Detailed scenario
None
Technical description
Documentation
This pull request adds a new PHPStan rule to enforce the usage of typed filters and includes tests to ensure its proper functionality. The most important changes include the addition of the new rule, updates to the PHPStan configuration, and the creation of test cases to validate the rule.
New Rule Addition:
tests/phpstan/Rules/ApplyFiltersTypedDynamicFunctionReturnTypeExtension.php
: Added a new PHPStan rule to enforce the use ofwpm_apply_filters_typed
with properly documented@param
tags.Configuration Updates:
phpstan.neon.dist
: Updated the PHPStan configuration to include the new ruleWP_Rocket\Tests\phpstan\Rules\ApplyFiltersTypedDynamicFunctionReturnTypeExtension
.phpstan-baseline.neon
: Added a new baseline entry for the rule to handle invalid@param
tags.Test Cases:
tests/phpstan/tests/Rules/ApplyFiltersTypedDynamicFunctionReturnTypeExtensionTest.php
: Added test cases to validate the new rule, including tests for valid usage, missing types, wrong types, and missing docblocks.tests/phpstan/tests/data/ApplyFiltersTypedDynamicFunctionReturnTypeExtensionTest/missing-docblock.php
: Added a test case for a missing docblock scenario.tests/phpstan/tests/data/ApplyFiltersTypedDynamicFunctionReturnTypeExtensionTest/missing-type.php
: Added a test case for a missing type in the@param
tag.tests/phpstan/tests/data/ApplyFiltersTypedDynamicFunctionReturnTypeExtensionTest/valid.php
: Added a test case for valid usage of thewpm_apply_filters_typed
function.tests/phpstan/tests/data/ApplyFiltersTypedDynamicFunctionReturnTypeExtensionTest/wrong-type.php
: Added a test case for an incorrect type in the@param
tag.New dependencies
None
Risks
None
Mandatory Checklist
Code validation
Code style
Unticked items justification
WIP