Reduce PHPStan baseline: use class-string instead - #3799
Open
VentyCZ wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
馃煛 Changes recommended
A couple of the new PHPDoc types over-promise (or rely on less-portable syntax) and should be adjusted to keep the type contracts accurate and reliably interpreted by tooling.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR continues the effort to reduce phpstan-baseline.php by addressing underlying type issues, primarily by replacing inline @var casts with more precise class-string<...> typing in field-related code.
Changes:
- Refines field class resolution typing in
FieldRepository::getFieldClassname()so downstream instantiation can be understood by PHPStan. - Improves PHPDoc typing for discriminator-map computation in
FieldDiscriminatorListener, including typed map properties andclass-stringannotations. - Removes PHPStan baseline suppressions that are no longer needed for
FieldDiscriminatorListener.
File summaries
| File | Description |
|---|---|
| src/Repository/FieldRepository.php | Removes an inline cast in the factory path and adds class-string-based typing for field classname discovery. |
| src/Event/Listener/FieldDiscriminatorListener.php | Adds class-string-based typing for discriminator-map computation and removes the inline cast on instantiation. |
| phpstan-baseline.php | Drops ignore entries that should be resolved by the stronger typing changes. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 3
- Review effort level: Lite
馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Follow-up to #3758, continuing the effort to shrink
phpstan-baseline.phpby fixing the underlying type issues instead of suppressing them. (using class-string syntax instead of forcing with@var)