Skip to content
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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

Miraeld
Copy link
Contributor

@Miraeld Miraeld commented Nov 29, 2024

Description

Fixes #7126
Nothing impacts uers.

Type of change

  • Chore

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:

Updates to tests:

New dependencies

None

Risks

None

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

@Miraeld Miraeld added the noQA label Nov 29, 2024
@Miraeld Miraeld requested a review from a team November 29, 2024 07:24
@Miraeld Miraeld self-assigned this Nov 29, 2024
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for dd33f7b1 (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (dd33f7b) Report Missing Report Missing Report Missing
Head commit (cd63845) 38228 16731 43.77%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#7155) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@wordpressfan
Copy link
Contributor

@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?

@Miraeld
Copy link
Contributor Author

Miraeld commented Nov 29, 2024

@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.

@CrochetFeve0251
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHPStan : Discourage the usage of WordPress Options functions inside an object in favor of the Option class
4 participants