Fix mixing property and param attributes on promoted property#2825
Closed
RobertMe wants to merge 1 commit intophpstan:1.10.xfrom
Closed
Fix mixing property and param attributes on promoted property#2825RobertMe wants to merge 1 commit intophpstan:1.10.xfrom
RobertMe wants to merge 1 commit intophpstan:1.10.xfrom
Conversation
ec215cb to
bad19f1
Compare
Simplify the ParamAttributesRule by merging AttributeCheck::check calls and using an int mask to check for both TARGET_PARAMETER and TARGET_PROPERTY in one pass. Fixes #10298
bad19f1 to
0fc5866
Compare
Member
|
There is no bug to fix: phpstan/phpstan#10298 (comment) |
darenas31415
reviewed
Jan 6, 2024
| public function __construct( | ||
| #[PropAttr] | ||
| #[ParamAttr] | ||
| public string $test |
There was a problem hiding this comment.
Coming from this issue phpstan/phpstan#10385 maybe you could improve the test suite by adding another test case to cover when an attribute has both property and parameter targets like:
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_PARAMETER)]
class PropAndParamAttr {}
class Test
{
public function __construct(
#[PropAndParamAttr]
public string $test
) {}
}
Member
There was a problem hiding this comment.
I believe there is already such a test. Feel free to check that and send a PR in case it isn't 😊
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.
Simplify the ParamAttributesRule by merging AttributeCheck::check calls and using an int mask to check for both TARGET_PARAMETER and TARGET_PROPERTY in one pass.
Fixes phpstan/phpstan#10298