Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PHPStan-specific annotations when using PHPStan alias types #60

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

uuf6429
Copy link
Member

@uuf6429 uuf6429 commented Jan 6, 2025

No description provided.

@uuf6429 uuf6429 requested review from stof and aik099 January 6, 2025 11:41
Copy link

codecov bot commented Jan 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.74%. Comparing base (8bee0da) to head (f4db0a9).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##               main      #60   +/-   ##
=========================================
  Coverage     87.74%   87.74%           
  Complexity      197      197           
=========================================
  Files             1        1           
  Lines           506      506           
=========================================
  Hits            444      444           
  Misses           62       62           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aik099
Copy link
Member

aik099 commented Jan 6, 2025

The PR title is misleading. Phpstan types already work, but the way how they're specified breaks other stuff.

I'd suggest rename to Use PhpStan-specific PhpDoc annotations for data types, that only PhpStan can understand. or something similar.

@uuf6429 uuf6429 changed the title Aliased types require phpstan annotations Use PHPStan-specific annotations for PHPStan alias types Jan 6, 2025
@uuf6429 uuf6429 changed the title Use PHPStan-specific annotations for PHPStan alias types Use PHPStan-specific annotations when using PHPStan alias types Jan 6, 2025
@uuf6429 uuf6429 requested a review from aik099 January 6, 2025 15:16
@oleg-andreyev
Copy link

@uuf6429 I assume it's because of "other" IDE then PhpStorm? because PS does understand this type tags

@uuf6429
Copy link
Member Author

uuf6429 commented Jan 7, 2025

@uuf6429 I assume it's because of "other" IDE then PhpStorm? because PS does understand this type tags

Nah, it's about other tools, for example psalm. @stof made a good point about, so I'm fixing it in this PR.

@stof
Copy link
Member

stof commented Jan 7, 2025

Psalm actually knows about phpstan type aliases (if the type used in them is supported by psalm, as it converts it to a psalm type alias). However, some other tools don't support it (for instance, symfony/type-info)

@uuf6429 uuf6429 merged commit ac46ffe into main Jan 7, 2025
32 checks passed
@uuf6429 uuf6429 deleted the chore/use-phpstan-annotations branch January 7, 2025 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants