Widen the Rector config to the remaining class-based trees (Streaming,
Public\Controllers, Ministra), keeping the templates, procedural
front-controllers (Public/stream, Public/admin, Ministra/portal.php) and the
streaming hot-path bootstraps out. Also document the recurring dropped-parens
bug + the review grep in the config header.
The resulting 107-file pass (94 Public\Controllers, 11 Streaming, 2 Ministra)
was reviewed against the suite + PHPStan + the usual scans:
- No dropped-parens bug this time (the assignment-in-condition pattern didn't
occur in these files).
- 6 locally-called private static helpers became instance methods
(behaviour-preserving; all called via $this->, no static call sites); one
unused private param dropped (FanoutConfig::desired $rSnapshot, call site
updated).
- De Morgan / ternary / dead-code simplifications; two `$x = getById()`
truthy-assignments folded into the condition (no comparison, safe).
PHPStan level 5 clean; suite 721 tests / 0 errors.
Mechanical, behaviour-preserving reformat produced by 'make cs-fix' under
the new build/phpcs.xml.dist ruleset: K&R braces, tab indentation, and the
other whitespace normalisations. No logic changes.
Replace the RequestManager::getAll()['key'] whole-array-then-index pattern with
the per-key accessors across controllers, views and infrastructure:
- reads (incl. nested getAll()['order'][0]['column'] and empty(...)) -> get('key')
- isset(getAll()['key']) -> has('key')
get() returns the raw value unchanged, so comparisons, concatenation, ?? and
nested indexing behave exactly as before while missing keys stop raising PHP 8
undefined-key warnings.
Deliberately left as getAll() where get() would be invalid: unset() targets,
write context (getAll()['k'] = ...) and nested isset(getAll()['a']['b']).
Both single- and double-quoted keys and the fully-qualified RequestManager
reference are handled.
Apply 'make cs-fix' — 493 files. Mechanical, import-block only:
- sort use statements alphabetically (class/function/const grouped);
- drop imports left unused by the PSR-4 migration (e.g. classes referenced by
leading-backslash FQCN whose redundant 'use' the automated insertion had added);
- one blank line after namespace and after the import block; collapse stray
blank lines around use.
No logic changes. Verified: php -l clean; PHPStan no errors; PHPUnit 295/295; and a
temporary PHPStan pass over src/Public/Controllers confirms no still-referenced
import was removed (0 unresolved classes). 'use' after inline HTML in view
templates is valid and aliases correctly (verified) — those imports are sorted too.
Namespace all 174 Public controllers into XcVm\Public\Controllers\<Admin|Api|
Player|Reseller>, completing the per-file namespace migration. View templates and
entry points (index.php, admin/*.php, stream/*.php, progress/, routes/*.php,
Views/*) stay procedural/global and only gain use imports.
- Split the 3 multi-class Api files per PSR-4: AdminApiController→+AdminAPIWrapper,
Enigma2ApiController→+SimpleXMLExtended (extends \SimpleXMLElement),
ResellerRestApiController→+ResellerAPIWrapper (use-block copied to each new file).
- Add use to referrers — the procedural route files (routes/admin|player|reseller.php)
and index.php now import each routed controller; sibling controllers extend their
base class in the same namespace.
- Qualify built-ins/ioncube/global in the namespaced controllers (\Exception,
\DateTime, \PDO, \SimpleXMLElement, \ZipArchive, \ReflectionClass,
\XC_Bootstrap, \XC_VM, ...). Verified zero unresolved classes by temporarily
analysing src/Public/Controllers under PHPStan, then reverting to scanDirectories
(the ~346 pre-existing legacy findings there are out of scope for this migration).
Verified: php -l clean; PHPStan no errors; PHPUnit 295/295; no global controller
class-files remain; leading-backslash re-sweep clean.
Move Core/Http into XcVm\Core\Http (ApiClient, CurlClient, RequestManager,
Request, Response, Router) and Core/Http/Pipeline into XcVm\Core\Http\Pipeline
(StreamContext, StreamMiddlewareInterface, StreamPipeline). RequestGuard.php is
procedural (global functions) and stays global.
- Namespace the 9 classes; qualify still-global deps with leading backslash
(\ServerRepository in ApiClient; \Authorization, \ServiceContainer,
\AdminHelpers in Router) and built-in \Throwable; same-namespace siblings
unqualified.
- Add 'use XcVm\Core\Http\...;' to referencing files — RequestManager 128,
Router 19, ApiClient 15, Request 11, Response 6, CurlClient 5, plus Pipeline —
across src/ and tests/.
- Rewrite the modules' 'use Router;' → 'use XcVm\Core\Http\Router;' (plex,
watch, tmdb).
- Fix pre-existing leading-backslash global refs (\Router etc.) to the FQCN.
- Tests: fully-qualify the Router type hint in generated module fixtures
(registerRoutes(\XcVm\Core\Http\Router ...)) and update the
InterfaceContractTest param-type expectation to the FQCN. Also repaired two
fixtures where the use-inserter mis-placed a 'use' (files declare a method
literally named namespace(), which the tokenizer reports as T_NAMESPACE).
- phpstan-baseline.neon regenerated (292→292; class names in frozen messages
gained the namespace, no new/unknown-class errors).
Verified: php -l clean; PHPStan no errors; PHPUnit 295/295; Http classes resolve
via Composer; leading-backslash re-sweep across migrated classes is clean.