Wave 5a-G: phpstan zero — tail sweep + test fatal fix#90
Merged
Conversation
… fix
Drives whole-tree phpstan level-9 errors to 0 across the 44 files
remaining after clusters A–F. Phlex-server master phpstan reports
`{errors: 0, file_errors: 0}` after this PR.
Also repairs the pre-existing `StructuredLoggerPsrAdapterTest` fatal
(anonymous spy class narrowed the parent log() signature, violating LSP).
Highlights:
- Introduce `Phlex\Common\Util\RowMap` (narrows mixed DB rows to
array<string, mixed>) and reuse `Phlex\LiveTv\Dto\Row{Access,Query}`
in CollectionRepository, SmartPlaylistRepository, RecordingDeduplicator,
AudiobookProgressStore, MediaItem.
- Rename src/Server/WebSocket/Events.php to WebSocketEvents.php (PSR-4);
leave a thin compat-shim at the old path so phpstan's excludePath entry
still resolves until Wave 5b refreshes the config.
- Surface several pre-existing latent bugs (see commit body):
- PlaybackController called ContainerFactory::getInstance() which does
not exist; convert to constructor-injected PlayToManager.
- AudiobookScanner called \getID3() as a function; package ships a
class. Probe class_exists('getID3', false) and use ->analyze().
- TraktHistorySync's findMediaItemId stub returned `null` literal,
which made parseWatchedAt / extractDurationTicks unreachable dead
code. Stub now returns ?string and reads an optional
`_resolved_media_item_id` hint so the surrounding loop is alive
pending the real TMDB/TVDB/IMDB lookup.
- Remove dead `ENCODER_PREFIX` / `DECODER_PREFIX` constants from 6
VendorProbe classes.
- Narrow `Request::input()` / `$request->body` / `$params` mixed values
in 8 controllers (Stats, Trakt OAuth, Webhook admin, Chromecast,
Roku, DLNA renderer, Dashboard).
- Remove 5 stale `phpstan-baseline.neon` entries whose underlying
errors were already fixed by clusters A–F (LiveTvManager x3,
PlaybackController::$logger property.onlyWritten, SyncPlayManager
Monolog Level argument.type).
Wave 5a is COMPLETE with this merge (PRs #83–#88 + #89 + this). Wave 5b
(delete the 3,619-line `phpstan-baseline.neon` and drive the absorbed
errors to zero) is the next step.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Summary
{errors: 0, file_errors: 0}after this PR.StructuredLoggerPsrAdapterTestfatal (anonymous spy class violated LSP — diagnosed in PR Wave 5a-B: phpstan zero on Admin/Core/Logger cluster #87).Wave 5a is COMPLETE with this merge (PRs #83–#88 + #89 + this). Wave 5b (delete the 3,619-line phpstan-baseline.neon and drive the absorbed errors to zero) is the next step.
Highlights
Phlex\Common\Util\RowMap(narrows mixed DB rows to array<string, mixed>); reused in CollectionRepository, SmartPlaylistRepository, RecordingDeduplicator, AudiobookProgressStore, MediaItemPhlex\LiveTv\Dto\RowAccess/RowQueryfrom PR Wave 5a-D: phpstan zero on LiveTv + HdHomeRunTunerDriver test fix #88 in RecordingDeduplicatorENCODER_PREFIX/DECODER_PREFIXconstants from VendorProbe classesContainerFactory::getInstance()— converted to constructor-injected PlayToManager\getID3()as a function but the package ships a class — probe class_exists and useanalyze()nullliteral which made the rest of the loop unreachable dead codeTest plan
{errors: 0, file_errors: 0}🤖 Generated with Claude Code