fix: describe() modifier calls and arch expectation methods on internal interfaces - #13
Merged
Merged
Conversation
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.
Fixes two PHPStan false-positives reported against Pest's dynamic API.
describe()block modifiers (->skip(),->with(), …)At runtime,
DescribeCall::__call()forwards every call to a freshBeforeEachCall, which itself documents@mixin TestCall. That delegation was invisible to static analysis, so valid code like:was reported as:
Instead of hard-coding a method list into a reflection extension, a stub now declares the actual runtime relationship (
@mixin BeforeEachCall) onDescribeCall, and PHPStan resolves modifiers through its native mixin logic. This means:skip(),with(),group(),after()and chained combinations all type-check,actingAs()) keep working through the existing TestCall extension,TestCall/BeforeEachCallare picked up automatically — nothing to maintain.Methods of
@internalarch interfacesPest\Arch\Contracts\ArchExpectationis marked@internalupstream while being the documented public surface of architecture testing. With PHPStan'sinternalTagfeature toggle (part of bleeding edge), documented chains such as:were reported as:
The suppression extension already covered
method.internalClass,method.internalTrait, andproperty.internalClass; it now also coversmethod.internalInterfacefor receivers typed asPest\*.Testing
tests/Rules/DescribeCallMethodTest.php: covers->skip(),->with(), chained modifiers, and->after()on describe blocks.tests/Rules/PestInternalClassAccessIgnoreExtensionTest.php: runs withfeatureToggles.internalTag: trueso the regression genuinely exercises the previously failing path.Fixes pestphp/pest#1837 and fixes pestphp/pest#1831