Skip to content

Reduce PHPStan baseline: use class-string instead - #3799

Open
VentyCZ wants to merge 3 commits into
bolt:6.1from
VentyCZ:reduce-baseline
Open

Reduce PHPStan baseline: use class-string instead#3799
VentyCZ wants to merge 3 commits into
bolt:6.1from
VentyCZ:reduce-baseline

Conversation

@VentyCZ

@VentyCZ VentyCZ commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #3758, continuing the effort to shrink phpstan-baseline.php by fixing the underlying type issues instead of suppressing them. (using class-string syntax instead of forcing with @var)

Copilot AI lite review requested due to automatic review settings August 30, 2026 15:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

馃煛 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 and class-string annotations.
  • 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.

Comment thread src/Repository/FieldRepository.php
Comment thread src/Repository/FieldRepository.php Outdated
Comment thread src/Event/Listener/FieldDiscriminatorListener.php
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.

2 participants