-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closes #7126: PHPStan ~ Discourage wp option function #7155
base: develop
Are you sure you want to change the base?
Conversation
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more Footnotes
|
@Miraeld May I ask why do u add all of those ignores? the baseline idea doesn't work here? or maybe I miss something, can u plz explain? |
I've used the baseline system, check the last commit. I haven't added any ignore, I've refactored the previous "update_option()" rule to include more functions related to options and that we can and should manage with our own Option object. |
@Miraeld I didn't see any test outside a class. This is a test we need as we don't want to raise the alert in that scenario. |
Description
Fixes #7126
Nothing impacts uers.
Type of change
Detailed scenario
None
Technical description
Documentation
This pull request includes changes to update and expand the PHPStan rules for discouraging the use of certain WordPress functions. The key changes involve renaming a rule class, adding new discouraged functions, and updating the corresponding tests.
Updates to PHPStan rules:
phpstan.neon.dist
: Renamed the ruleDiscourageUpdateOptionUsage
toDiscourageWPOptionUsage
to reflect the broader scope of discouraged functions.tests/phpstan/Rules/DiscourageWPOptionUsage.php
: Created a new rule classDiscourageWPOptionUsage
that discourages the use ofupdate_option
,get_option
, anddelete_option
functions, replacing the previousDiscourageUpdateOptionUsage
rule.tests/phpstan/Rules/DiscourageUpdateOptionUsage.php
: Removed the old rule classDiscourageUpdateOptionUsage
.Updates to tests:
tests/phpstan/tests/Rules/DiscourageWPOptionUsageTest.php
: Added new test cases for theDiscourageWPOptionUsage
rule to verify that errors are correctly reported fordelete_option
,get_option
, andupdate_option
functions.tests/phpstan/tests/Rules/DiscourageUpdateOptionUsageTest.php
: Removed the old test classDiscourageUpdateOptionUsageTest
.DiscourageWPOptionUsageTest
:tests/phpstan/tests/data/DiscourageWPOptionUsageTest/use-delete-option.php
: Test data fordelete_option
function.tests/phpstan/tests/data/DiscourageWPOptionUsageTest/use-get-option.php
: Test data forget_option
function.tests/phpstan/tests/data/DiscourageWPOptionUsageTest/use-update-option.php
: Test data forupdate_option
function.tests/phpstan/tests/data/DiscourageUpdateOptionUsageTest/not-valid.php
.New dependencies
None
Risks
None
Mandatory Checklist
Code validation
Code style