Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Validator] Enhance PHPDoc onConstraint::getTargets()#58493

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@alexandre-daubois
Copy link
Member

@alexandre-dauboisalexandre-daubois commentedOct 8, 2024
edited
Loading

QA
Branch?7.2
Bug fix?no
New feature?no
Deprecations?no
Issues-
LicenseMIT

Provides better static analysis on constraints.

@carsonbotcarsonbot added this to the7.2 milestoneOct 8, 2024
@alexandre-dauboisalexandre-dauboisforce-pushed theconstraint-phpdoc branch 2 times, most recently fromb2b9050 to987af2fCompareOctober 8, 2024 11:53
* Constraint::CLASS_CONSTRAINT and Constraint::PROPERTY_CONSTRAINT.
*
* @return string|string[] One or more constant values
* @return self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT|array<self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT> One or more constant values

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

wouldn't this work?

Suggested change
* @return self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT|array<self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT> Oneor more constant values
* @return self::*_CONSTRAINT|array<self::*_CONSTRAINT> Oneor more constant values

Copy link
MemberAuthor

@alexandre-dauboisalexandre-dauboisOct 8, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It works:https://phpstan.org/r/e511c5d3-eacc-4d1d-b9b3-c45683a3429f

I hesitated, because we could unintentionally include new constants ending with_CONSTRAINT. But if it seems OK to you, I'm fine with it 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It appears to not work for Psalm (https://psalm.dev/r/25734b245c), which is a requirement for us (as this is what we use in our own CI).

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Oh right, let's keep it as-is then. Thanks!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

then:

Suggested change
* @return self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT|array<self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT> Oneor more constant values
* @return self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT|array<self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT>

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Indeed!

@alexandre-dauboisalexandre-dauboisforce-pushed theconstraint-phpdoc branch 3 times, most recently from7f5ce66 tobc81173CompareOctober 8, 2024 14:58
@nicolas-grekas
Copy link
Member

Thank you@alexandre-daubois.

@nicolas-grekasnicolas-grekas merged commit5cabe45 intosymfony:7.2Oct 9, 2024
8 of 10 checks passed
@alexandre-dauboisalexandre-daubois deleted the constraint-phpdoc branchOctober 9, 2024 14:28
xabbuh added a commit that referenced this pull requestOct 14, 2024
…return types (xabbuh)This PR was merged into the 7.2 branch.Discussion----------[ErrorHandler] resolve class constant types when patching return types| Q             | A| ------------- | ---| Branch?       | 7.2| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Issues        || License       | MITaccount for types like the ones added in#58493Commits-------01eb32c resolve class constant types when patching return types
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@wouterjwouterjwouterj left review comments

@stofstofstof approved these changes

@xabbuhxabbuhxabbuh approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

7.2

Development

Successfully merging this pull request may close these issues.

6 participants

@alexandre-daubois@nicolas-grekas@stof@wouterj@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp