Skip to content

chore(phpstan): enable level 4 for tests/ - #1891

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

JohnVillalovos merged 1 commit into
developfrom
jlvillal/phpstan

Conversation

@JohnVillalovos

Copy link
Copy Markdown
Collaborator

Fix the level 4 findings in tests/ and remove the last entries from the phpstan_next exclude list:

  • Fix ScheduleReservationListTest asserting on slot 0 instead of slot 4, the FakePaymentRepository save that never stored the result and FakeUploadedFile::Error() missing its return.
  • Drop write-only test properties and unused helpers, including ExistingReservationSeriesBuilder::WithResources() and the always-skipped ImportICalPresenterTest::testParseIcs() with its fixture.
  • Add failing default arms to match expressions in PHPUnit callbacks.
  • Remove assertions that cannot fail and use addToAssertionCount() where a test only checks that no exception is thrown.
  • Simplify checks on values that cannot be false or missing in the integration server helpers, and check disable_functions for proc_open instead of is_callable().
  • Annotate the legacy $conf array and narrow closure return types.

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

Fix the level 4 findings in tests/ and remove the last entries from
the phpstan_next exclude list:

- Fix ScheduleReservationListTest asserting on slot 0 instead of slot
  4, the FakePaymentRepository save that never stored the result and
  FakeUploadedFile::Error() missing its return.
- Drop write-only test properties and unused helpers, including
  ExistingReservationSeriesBuilder::WithResources() and the
  always-skipped ImportICalPresenterTest::testParseIcs() with its
  fixture.
- Add failing default arms to match expressions in PHPUnit callbacks.
- Remove assertions that cannot fail and use addToAssertionCount()
  where a test only checks that no exception is thrown.
- Simplify checks on values that cannot be false or missing in the
  integration server helpers, and check disable_functions for
  proc_open instead of is_callable().
- Annotate the legacy $conf array and narrow closure return types.

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 changes address the remaining PHPStan findings, correct test doubles and assertions, remove obsolete scaffolding, and eliminate the outstanding test exclusions without any active review issues identified.

No open issues 🎉

What changed in this PR

This pull request enables PHPStan level 4 analysis for the test suite by fixing remaining findings, correcting test doubles and assertions, removing obsolete scaffolding, and clearing the final test exclusions.

Changes:

  • Corrects fake repository/upload behavior and a schedule-slot assertion.
  • Removes unused properties, helpers, skipped tests, and an obsolete iCalendar fixture.
  • Adds exhaustive callback handling, improves assertion counting, narrows types, and simplifies integration checks.
  • Removes the remaining tests/ exclusions from phpstan_next.neon.
File Description
tests/​src/​Application/​Admin/​ServerEnvironmentTest.php Narrows test closure return types.
tests/​Presenters/​SearchAvailabilityPresenterTest.php Removes unused reservation and blackout helpers.
tests/​Presenters/​Reservation/​ReservationUpdatePresenterTest.php Removes unused user ID state.
tests/​Presenters/​Reservation/​ReservationSavePresenterTest.php Removes unused user ID state.
tests/​Presenters/​Reservation/​ReservationMovePresenterTest.php Removes unused user ID state.
tests/​Presenters/​Reservation/​ReservationEmailPresenterTest.php Removes unused user state and setup.
tests/​Presenters/​Reservation/​ReservationDeletePresenterTest.php Removes unused user ID state.
tests/​Presenters/​Reservation/​NewReservationPresenterTest.php Removes unused user ID state.
tests/​Presenters/​Reservation/​ExistingReservationInitializerTest.php Removes unused user ID state.
tests/​Presenters/​Reservation/​EditReservationPresenterTest.php Removes unused user ID state.
tests/​Presenters/​PersonalCalendarPresenterTest.php Removes an unused calendar factory mock.
tests/​Presenters/​Dashboard/​UpcomingReservationsPresenterTest.php Removes an unused presenter property.
tests/​Presenters/​CalendarPresenterTest.php Removes an unused calendar factory mock.
tests/​Presenters/​Admin/​MyCal.ics Removes the obsolete skipped-test fixture.
tests/​Presenters/​Admin/​ManageUsersPresenterTest.php Adds an exhaustive callback match arm.
tests/​Presenters/​Admin/​ManageSchedulesPresenterTest.php Adds an exhaustive callback match arm.
tests/​Presenters/​Admin/​ManageReservationsPresenterTest.php Adds exhaustive callback handling.
tests/​Presenters/​Admin/​ManageConfigurationPresenterTest.php Removes an unused assertion helper.
tests/​Presenters/​Admin/​ImportICalPresenterTest.php Removes an always-skipped test.
tests/​Plugins/​Authentication/​PluginConfigLoadingTest.php Uses explicit assertion counting for no-exception checks.
tests/​Plugins/​Authentication/​Ldap/​LdapTest.php Removes unused encryption setup.
tests/​Plugins/​Authentication/​ActiveDirectory/​ActiveDirectoryTest.php Removes unused test dependencies.
tests/​Integration/​SmokeTest.php Improves disabled-function detection and status handling.
tests/​Integration/​router.php Simplifies checks for guaranteed values.
tests/​Infrastructure/​Database/​DatabaseTest.php Removes an assertion that could not fail.
tests/​Infrastructure/​Config/​EnableSubscriptionTest.php Annotates the legacy configuration array.
tests/​Infrastructure/​Config/​ConfigTest.php Annotates the legacy configuration array.
tests/​Infrastructure/​Common/​URIParamValidatorTest.php Adds an exhaustive validator match arm.
tests/​Infrastructure/​Common/​SmartyControlTest.php Removes unused style state.
tests/​Infrastructure/​Common/​DateTest.php Removes unused timezone state.
tests/​fakes/​FakeUploadedFile.php Returns the configured upload error.
tests/​fakes/​FakePaymentRepository.php Stores the last PayPal payment result.
tests/​fakes/​ExistingReservationSeriesBuilder.php Removes unused resource state and its builder method.
tests/​Application/​Schedule/​ScheduleReservationListTest.php Corrects the buffer-slot assertion index.
tests/​Application/​Schedule/​ResourceServiceTest.php Adds exhaustive callback handling.
tests/​Application/​Reservation/​SchedulePeriodRuleTest.php Makes callback handling exhaustive and narrows return logic.
tests/​Application/​Reservation/​ReservationComponentTest.php Removes an unused attribute repository mock.
tests/​Application/​Authentication/​AuthenticationTest.php Removes unused authentication test state.
phpstan_next.neon Removes the remaining test-directory exclusions.

This pull request is too complex or risky for automated approval.

Review effort: Lite

@JohnVillalovos
JohnVillalovos merged commit 7b2b2f6 into develop Nov 10, 2026
19 checks passed
@JohnVillalovos
JohnVillalovos deleted the jlvillal/phpstan branch November 10, 2026 00:20
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