Closes #35: Remove WP Rocket coupling from generic package - #46
Merged
Conversation
…kage ApiTrait::getApiCredential() now resolves constants with a neutral defined()/constant() check instead of calling WP Rocket's rocket_get_constant() helper, and the rocket_get_constant()/ rocket_has_constant() polyfills are removed from Fixtures/polyfills.php so consumers of this generic package no longer inherit a rocket_-prefixed coupling. Closes #35 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…t suite to standard Follow-up to the #35 WP Rocket decoupling: removes src/Fixtures/polyfills.php entirely along with TestCaseTrait::stubPolyfills() and Unit\TestCase's $stubPolyfills gate, since nothing in the package uses that extension point anymore. Adds declare(strict_types=1) to every file touched by this change, brings ApiTrait.php, TestCaseTrait.php, and Unit\TestCase.php into PHPCS scope (0 violations), and rewrites the ApiTrait unit test as a single @dataProvider-driven test following the getDefaultVfs() convention, with its scenarios in Tests/Fixtures/ApiTrait/getApiCredential.php. Refs #35 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The src/Fixtures directory was removed along with the empty polyfills file; PHPStan CI failed because the path no longer exists. Refs #35 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Closes #35
Description
Removes hard-coded WP Rocket coupling from the package, replacing
rocket_get_constant()androcket_has_constant()helpers with neutral inlinedefined()/constant()accessors. This allows consumers to use this generic package without inheriting WP Rocket-specific dependencies.What was done
ApiTrait::getApiCredential()to use standard PHPdefined()/constant()checks instead of WP Rocket helpersrocket_get_constant()androcket_has_constant()polyfills fromFixtures/polyfills.phpHow to test
phpunitphpstan analyseandphpcsFiles changed
Type of change
Affected Features & Quality Assurance Scope
Technical description
The package previously relied on WP Rocket's
rocket_get_constant()helper to safely resolve constants. This created an unnecessary coupling to a specific WordPress plugin. The solution uses PHP's nativedefined()andconstant()functions directly, which is more portable and doesn't require external dependencies.New dependencies
None.
Risks
None identified. This is purely an internal refactoring that maintains backward compatibility for consumers of the package.