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.