Repository navigation
chore(phpstan): enable level 4 for lib/Application/ - #1889
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The nullable title can still violate the interface’s string contract and propagate a null reservation label, so the active moderate finding requires a boundary or contract fix.
1 open issue
What changed in this PR
This pull request enables PHPStan level 4 analysis for lib/Application/ by removing dead code and unused state, simplifying redundant conditions, and correcting type annotations.
Changes:
- Removes
lib/Application/from the PHPStan exclusion list. - Deletes unreachable code, unused methods, properties, constructor parameters, and the unused attribute API.
- Simplifies redundant checks and boolean expressions.
- Corrects nullable reservation fields and the
ReportCell::$chartColumnTypePHPDoc.
Review finding: Domain/ReservationItemView.php has a moderate issue (2 votes): GetTitle() may return null despite the IReservedItemView contract promising string. The contract should allow null, or the title should be normalized to '' at the boundary.
| File | Description |
|---|---|
phpstan_next.neon |
Removes lib/Application/ from the PHPStan exclusion list. |
lib/Application/Schedule/ScheduleReservationList.php |
Removes the unused midnight property and initialization. |
lib/Application/Schedule/DisplaySlotFactory.php |
Removes unreachable returns and unused helper methods. |
lib/Application/Schedule/CalendarWeek.php |
Removes unused timezone state and its constructor argument. |
lib/Application/Schedule/CalendarMonth.php |
Updates CalendarWeek construction for the simplified constructor. |
lib/Application/Reservation/Validation/AccessoryResourceRule.php |
Removes a redundant null comparison. |
lib/Application/Reservation/ReservationInitializerFactory.php |
Removes unused user repository state. |
lib/Application/Reservation/ReservationInitializerBase.php |
Removes the unused AddAttribute() API and backing storage. |
lib/Application/Reservation/ExistingReservationInitializer.php |
Removes the unused page property. |
lib/Application/Reporting/ReportColumn.php |
Corrects the chartColumnType PHPDoc type. |
lib/Application/Attributes/AttributeService.php |
Simplifies redundant boolean expressions. |
lib/Application/Admin/ResourceImportCsv.php |
Removes a redundant CSV-row guard. |
Domain/ReservationItemView.php |
Documents nullable reservation and owner fields; title contract handling remains unresolved. |
Review effort: Lite
Fix the level 4 findings in lib/Application/ and remove it from the phpstan_next exclude list: - Remove dead code: unreachable returns and three unused private methods in DisplaySlotFactory, and the never-called IReservationComponentInitializer::AddAttribute() with the attribute list it filled. - Drop write-only properties: ExistingReservationInitializer's page, ReservationInitializerFactory's user repository, ScheduleReservationList's midnight and CalendarWeek's timezone (along with its now unused constructor argument). - Simplify "!A || (A && B)" to "!A || B" in AttributeService and drop redundant checks in ResourceImportCsv and AccessoryResourceRule. - Mark ReservationItemView's title, description and owner phone, organization and position as nullable; they come from nullable columns, which is why callers guard them with "?? ''". - Correct the PHPDoc type of ReportCell::$chartColumnType. Assisted-by: Claude:claude-opus-5-5
fec2bb8 to
7cf94fb
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The changes remove dead and redundant code while correcting nullable contracts and PHPDoc types needed to enable PHPStan level 4 analysis for the application layer.
No open issues 🎉
1 resolved since last review
Review effort: Lite

Fix the level 4 findings in lib/Application/ and remove it from the phpstan_next exclude list:
Assisted-by: Claude:claude-opus-5-5