Skip to content

Wave 5b-L: zero phpstan absorbed errors in LiveTv + Transcoding tails#92

Merged
detain merged 1 commit into
masterfrom
wave5b-l-livetv-transcoding
May 19, 2026
Merged

Wave 5b-L: zero phpstan absorbed errors in LiveTv + Transcoding tails#92
detain merged 1 commit into
masterfrom
wave5b-l-livetv-transcoding

Conversation

@detain
Copy link
Copy Markdown
Owner

@detain detain commented May 19, 2026

Summary

Drives baselined phpstan level-9 errors to 0 across the LiveTv + Transcoding tail cluster (89 baselined errors removed):

File 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

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_rows on Workerman\MySQL\Connection. Replaced with the documented query() return value for DELETE (rowCount as int).
  • GuideManager cache stored two incompatible value shapes under one property. Split into $programCache and $channelCache so static types match what each path actually returns.
  • TranscodeManager imported a non-existent Phlex\Common\Database\Connection; switched to the real Workerman\MySQL\Connection.
  • TranscodeManager::startTranscode() never honoured its $maxConcurrentTranscodes limit. Now enforced before scheduling any new job; $segmentDir and $maxConcurrentTranscodes exposed via getters (previously written-only).
  • TranscodeManager::getActiveTranscodeCount() inspected a nonexistent 'status' key on the active-job map; tightened to count the map directly.
  • 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 the constructor / registerProfile() always materialise a full profile shape.

Hydration helpers reused

Part of Wave 5b per HANDOFF_WAVE5_PLUS.md.

Test plan

  • ./vendor/bin/phpstan analyze on 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 errors
  • php -l on every modified file

🤖 Generated with Claude Code

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>
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@detain detain merged commit 3d728e3 into master May 19, 2026
3 of 9 checks passed
@detain detain deleted the wave5b-l-livetv-transcoding branch May 19, 2026 21:37
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.

1 participant