wp-media / wp-rocket

Performance optimization plugin for WordPress
https://wp-rocket.me
GNU General Public License v2.0
701 stars 220 forks source link

Closes #7123: Rules about get_subscribed_events #7124

Closed Miraeld closed 1 day ago

Miraeld commented 1 week ago

Description

Fixes #7123

This won't impact users.

Type of change

Detailed scenario

Just run PHPStan

Technical description

Documentation

This pull request introduces several changes related to PHPStan integration and testing in the project. The most significant updates include adding new PHPStan rules and tests, modifying the configuration files, and ensuring callback methods exist in subscribed events.

PHPStan Integration and Configuration:

New PHPStan Rule:

Tests for New Rule:

PHPUnit Configuration:

New dependencies

None

Risks

None

Mandatory Checklist

Code validation

Code style

codacy-production[bot] commented 1 week ago

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 90ca318cece30d1c6404e86cc885795163a95ba1[^1] :white_check_mark: (target: 50.00%)
Coverage variation details | | Coverable lines | Covered lines | Coverage | | ------------- | ------------- | ------------- | ------------- | | Common ancestor commit (90ca318cece30d1c6404e86cc885795163a95ba1) | Report Missing | Report Missing | Report Missing | | | Head commit (3fb06c76a4074f542dfaf47d03df1c4224493d74) | 38228 | 16731 | 43.77% | **Coverage variation** is the difference between the coverage for the head and common ancestor commits of the pull request branch: ` - `
Diff coverage details | | Coverable lines | Covered lines | Diff coverage | | ------------- | ------------- | ------------- | ------------- | | Pull request (#7124) | 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: `/ * 100%`

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more [^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.

Miraeld commented 5 days ago

I've treated your feedback @CrochetFeve0251 , Also, modified the way it was working a bit to comply with your tests.

Also, you'll notice I've added some // @php-stan-ignore-[next]-line That's because when phpstan run within this class, it kinda gets messed up with some type, even tho it's explicit, and due to this it thinks some part of the code are unreachable while in real they are.

I add a screenshot of your test passing as it isn't part of the CI in here.

Screenshot 2024-11-25 at 02 44 29