Skip to content

chore(phpstan): enable level 4 for Domain/ and Presenters/ - #1885

Merged
JohnVillalovos merged 1 commit into
developfrom
jlvillal/phpstan
Nov 9, 2026
Merged

JohnVillalovos merged 1 commit into
developfrom
jlvillal/phpstan

Conversation

@JohnVillalovos

Copy link
Copy Markdown
Collaborator

Fix the level 4 findings in Domain/ and Presenters/ and remove both from the phpstan_next exclude list:

  • Delete BookableResourceBuilder, which nothing uses.
  • Drop properties that are written but never read: the permission and role dirty flags on User and Group (the repositories persist the added/removed lists), ExistingReservationSeries' _originalRepeatOptions, ScheduleLayout's cached flag, ReservationReminder's interval and InvitationResult's series/user.
  • Drop unused constructor dependencies: the permission service of ManageAnnouncementsPresenter, the user preference repository of ManageResourcesPresenter, the persistence service of ReservationSavePresenter and the authentication of RegistrationPresenter (post-registration login is handled by the PostRegistration plugin), and update their callers.
  • Remove ActionPresenter::AddValidation() and the unused private ICalImportPresenter::GetTimezone().
  • Remove unreachable breaks after returns in SeriesUpdateScope and an always-true check in PastReservationsPresenter.
  • Correct the PHPDoc types of ReservationItemView::$bufferSeconds and ReservationReminderView::$interval.

Assisted-by: Claude:claude-opus-5-5

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.

🟢 Approval recommended

The review found no active issues, and the changes remove unused code while updating affected callers and PHPDoc to support the expanded PHPStan coverage.

No open issues 🎉

What changed in this PR

This pull request enables PHPStan level 4 analysis for Domain/ and Presenters/ by removing unused code and dependencies, simplifying affected callers, and correcting PHPDoc types.

Changes:

  • Removes unused builders, properties, methods, dependencies, and unreachable code.
  • Updates presenter factories, pages, and tests for simplified constructors.
  • Removes the relevant PHPStan exclusions and corrects PHPDoc annotations.
File Description
tests/​Presenters/​Reservation/​ReservationSavePresenterTest.php Updates test setup after removing the persistence dependency.
tests/​Presenters/​RegisterPresenterTest.php Removes obsolete authentication test setup and assertions.
tests/​Presenters/​Admin/​ManageResourcesPresenterTest.php Updates resource presenter construction.
Presenters/​Reservation/​ReservationSavePresenter.php Removes the unused persistence service dependency.
Presenters/​Reservation/​ReservationPresenterFactory.php Updates the reservation presenter factory call.
Presenters/​RegistrationPresenter.php Removes unused authentication handling.
Presenters/​GuestParticipationPresenter.php Removes unused invitation result state.
Presenters/​Dashboard/​PastReservationsPresenter.php Removes a redundant date check.
Presenters/​Admin/​ManageResourcesPresenter.php Removes the unused user preference repository.
Presenters/​Admin/​ManageAnnouncementsPresenter.php Removes the unused permission service.
Presenters/​Admin/​Import/​ICalImportPresenter.php Removes the unused timezone helper.
Presenters/​ActionPresenter.php Removes unused validation storage and registration logic.
phpstan_next.neon Removes Domain/ and Presenters/ from the PHPStan exclusions.
Pages/​Admin/​ResourceAdminManageResourcesPage.php Updates resource-admin presenter construction.
Pages/​Admin/​ManageResourcesPage.php Updates resource presenter construction.
Pages/​Admin/​ManageAnnouncementsPage.php Updates announcement presenter construction.
Domain/​Values/​SeriesUpdateScope.php Removes unreachable break statements.
Domain/​Values/​ReservationReminder.php Removes unused interval state.
Domain/​User.php Removes the unused permissions dirty flag.
Domain/​ScheduleLayout.php Removes the unused cached flag.
Domain/​ReservationReminderView.php Corrects the interval property PHPDoc.
Domain/​ReservationItemView.php Corrects the buffer-seconds property PHPDoc.
Domain/​Group.php Removes unused permissions and roles dirty flags.
Domain/​ExistingReservationSeries.php Removes unused original repeat-option state.
Domain/​BookableResource.php Deletes the unused BookableResourceBuilder class.

Review effort: Lite

Fix the level 4 findings in Domain/ and Presenters/ and remove both
from the phpstan_next exclude list:

- Delete BookableResourceBuilder, which nothing uses.
- Drop properties that are written but never read: the permission and
  role dirty flags on User and Group (the repositories persist the
  added/removed lists), ExistingReservationSeries'
  _originalRepeatOptions, ScheduleLayout's cached flag,
  ReservationReminder's interval and InvitationResult's series/user.
- Drop unused constructor dependencies: the permission service of
  ManageAnnouncementsPresenter, the user preference repository of
  ManageResourcesPresenter, the persistence service of
  ReservationSavePresenter and the authentication of
  RegistrationPresenter (post-registration login is handled by the
  PostRegistration plugin), and update their callers.
- Remove ActionPresenter::AddValidation() and the unused private
  ICalImportPresenter::GetTimezone().
- Remove unreachable breaks after returns in SeriesUpdateScope and an
  always-true check in PastReservationsPresenter.
- Correct the PHPDoc types of ReservationItemView::$bufferSeconds and
  ReservationReminderView::$interval.

Assisted-by: Claude:claude-opus-5-5
@JohnVillalovos
JohnVillalovos enabled auto-merge (rebase) November 9, 2026 22:38
@JohnVillalovos
JohnVillalovos merged commit bb71700 into develop Nov 9, 2026
17 checks passed
@JohnVillalovos
JohnVillalovos deleted the jlvillal/phpstan branch November 9, 2026 22:39
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