Wave 5b-L: zero phpstan absorbed errors in LiveTv + Transcoding tails#92
Merged
Conversation
Drives baselined phpstan level-9 errors to 0 across the LiveTv +
Transcoding tail cluster (89 baselined errors removed):
src/LiveTv/GuideManager.php 24
src/LiveTv/ChannelManager.php 21
src/LiveTv/LiveTvManager.php 5
src/Media/Transcoding/TranscodeManager.php 18
src/Media/Streaming/QualitySelector.php 11
src/Media/Transcoding/EncodingHelper.php 10
Real bugs / behaviour fixes uncovered while tightening types:
* GuideManager::cleanupOldPrograms() referenced a non-existent
$db->affected_rows on Workerman\\MySQL\\Connection. Replaced
with the documented return-value of query() for DELETE statements
(rowCount as int).
* GuideManager cache stored two incompatible value shapes under
one property. Split into $programCache and $channelCache so the
static types correspond to what each path actually returns.
* TranscodeManager imported a non-existent Phlex\\Common\\Database\\Connection;
switched to the real Workerman\\MySQL\\Connection used by the rest
of the project.
* TranscodeManager::startTranscode() never honoured its
$maxConcurrentTranscodes limit. Now enforced before scheduling
any new job, and the property is exposed via a getter alongside
$segmentDir (both were previously written-only).
* TranscodeManager::getActiveTranscodeCount() inspected a
nonexistent 'status' key on the active-job map; tightened to
count the map directly (any entry is by definition running).
* QualitySelector profile defaults were applied as a top-up via
array_merge, leaving user-supplied partial profiles with
missing required keys at runtime. Added normalizeProfile()
so registerProfile() / constructor always materialise a full
profile shape, eliminating the implicit fallback to 'generic'
at every read site.
Hydration helpers used: Phlex\\LiveTv\\Dto\\{RowAccess,RowQuery},
Phlex\\Common\\Util\\RowMap.
Whole-tree no-baseline error count: 720 -> 631 (-89).
Master-CI (phpstan with baseline): [OK].
phpstan-baseline.neon: 3163 -> 2888 lines (-275 lines, 55 entries removed).
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
Drives baselined phpstan level-9 errors to 0 across the LiveTv + Transcoding tail cluster (89 baselined errors removed):
Whole-tree no-baseline error count: 720 → 631 (-89). Master-CI (phpstan with baseline):
[OK].phpstan-baseline.neon: 3163 → 2888 lines (-275 lines, 55 entries removed).Real bugs uncovered while tightening types
GuideManager::cleanupOldPrograms()referenced a non-existent$db->affected_rowsonWorkerman\MySQL\Connection. Replaced with the documentedquery()return value for DELETE (rowCountasint).GuideManagercache stored two incompatible value shapes under one property. Split into$programCacheand$channelCacheso static types match what each path actually returns.TranscodeManagerimported a non-existentPhlex\Common\Database\Connection; switched to the realWorkerman\MySQL\Connection.TranscodeManager::startTranscode()never honoured its$maxConcurrentTranscodeslimit. Now enforced before scheduling any new job;$segmentDirand$maxConcurrentTranscodesexposed via getters (previously written-only).TranscodeManager::getActiveTranscodeCount()inspected a nonexistent'status'key on the active-job map; tightened to count the map directly.QualitySelectorprofile defaults were applied as a top-up viaarray_merge, leaving user-supplied partial profiles with missing required keys at runtime. AddednormalizeProfile()so the constructor /registerProfile()always materialise a full profile shape.Hydration helpers reused
Phlex\LiveTv\Dto\{RowAccess, RowQuery}(PR Wave 5a-D: phpstan zero on LiveTv + HdHomeRunTunerDriver test fix #88)Phlex\Common\Util\RowMap(PR Wave 5a-G: phpstan zero — tail sweep + test fatal fix #90)Part of Wave 5b per
HANDOFF_WAVE5_PLUS.md.Test plan
./vendor/bin/phpstan analyzeon the 6 scope files with no-baseline config →[OK]./vendor/bin/phpstan analyze src/ --level=9(with baseline) →[OK]./vendor/bin/phpunit tests/unit/LiveTv/{ChannelManagerTest,GuideManagerTest,LiveTvManagerTest}.php tests/unit/LiveTv/Dto tests/unit/Media/Streaming/QualitySelectorTest.php→ 56 tests pass./vendor/bin/phpunit tests/unit/Media/Transcoding/{Subtitles,FfmpegRunnerTest.php,Hwaccel}→ 164 tests pass./vendor/bin/phpcs --standard=PSR12 src/LiveTv/ src/Media/Transcoding/ src/Media/Streaming/→ 0 errorsphp -lon every modified file🤖 Generated with Claude Code