Files
XC_VM/build
Divarion_D 512a7a2985 fix: resolve all PHPStan errors and remove the frozen baseline
Drop build/phpstan-baseline.neon (122 frozen pre-existing errors) and fix
the underlying issues in source instead of suppressing them. A fresh
level-5 run without the baseline surfaced 158 errors across 56 files; all
are resolved. `make phpstan`, `make cs`, and `make gates` are green.

Fix categories:
- variable.undefined — initialize vars to a correct default before the
  branch/loop that conditionally set them, so every path defines them.
- return.type — align declared return types with reality (widen to
  array|false / ?array / \Movie|null etc. where callers handle the
  sentinel, or return the declared type consistently).
- argument.type — cast at call sites (curl_setopt/stream_set_blocking bool
  flags, str_replace/mktime/uniqid operands, \CurlHandle phpdoc).
- redundant/dead conditions — simplify always-true guards and drop
  unreachable else branches, preserving behavior.

Real latent bugs caught along the way:
- Core/Http/CurlClient — retry loop never incremented on failure and never
  broke on success (could spin); now retries as documented.
- Core/Util/StreamUtils — explode('=', $x, 1) meant path/domain query
  params were never parsed (limit 1 -> 2).
- Cli/CronJobs/RootSignalsCronJob — set_governor emitted an undefined PHP
  $i into the cpufreq-set bash command (now a literal shell $i).

Root-cause analyzer fixes (not suppressions):
- Database::ping()/num_rows() marked @phpstan-impure so repeated calls are
  not treated as constant (clears the ResellerApiDispatcher false cluster).
- StreamService::getArchive() $rReturn given an explicit @var for the
  loop-accumulated shape PHPStan cannot infer from array().

Two residual entries are documented false positives (analyzer limitations,
not bugs) as path-scoped ignoreErrors in phpstan.dist.neon:
- CacheHandlerCommand:66 — settings force-reloaded from DB mid-run.
- EpgCronJob:314 — reconnect-verify ping() after db_connect().

Also drops an unused `use ...Epg\EPG;` import in admin/api.php.
2026-08-27 15:24:41 +03:00
..