chore(psr4): phase 3 (Cli) — namespace Cli + switch console.php to FQCN discovery

Namespace all 55 Cli classes into XcVm\Cli (CommandInterface, CommandRegistry,
CronTrait, DaemonTrait), XcVm\Cli\Commands (28) and XcVm\Cli\CronJobs (23);
migration_logic.php stays procedural/global.

- console.php: switch command discovery from basename==classname + manual require
  to FQCN resolution — each scan dir maps to its PSR-4 namespace, classes load via
  Composer, implementsInterface(CommandInterface::class). Drop the manual
  CommandInterface/CommandRegistry requires. This is the atomic switch the plan
  required to land with the Cli namespacing.
- Commands/CronJobs get 'use XcVm\Cli\CommandInterface;' (implements) and the
  trait imports 'use XcVm\Cli\CronTrait;'/'DaemonTrait;'; rewrite the modules'
  'use CommandRegistry;' → FQCN; qualify built-ins/global (\ReflectionClass,
  \PDO, \Exception, \RuntimeException, \XC_Autoloader, \XC_VM).
- Fixtures: 'use CommandRegistry;' → FQCN; InterfaceContractTest registerCommands
  param-type → FQCN. phpstan-baseline.neon regenerated.

Verified: php -l clean; PHPStan no errors; PHPUnit 295/295; FQCN discovery resolves
51 classes (49 implement CommandInterface); no mangled FQCNs; re-sweep clean.
This commit is contained in:
Divarion-D
2026-06-25 19:03:39 +03:00
parent 62d2d1d942
commit 3377236d77
77 changed files with 445 additions and 226 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
<?php
use XcVm\Cli\CommandRegistry;
use XcVm\Core\Container\ServiceContainer;
use XcVm\Core\Module\ModuleLoader;
use XcVm\Core\Module\NavbarRegistry;
@@ -88,7 +89,7 @@ final class ModuleLoaderTest extends TestCase {
. 'use XcVm\Core\Module\ModuleInterface;' . "\n"
. 'use XcVm\Core\Container\ServiceContainer;' . "\n"
. 'use Router;' . "\n"
. 'use CommandRegistry;' . "\n"
. 'use XcVm\Cli\CommandRegistry;' . "\n"
. 'use XcVm\Core\Module\NavbarRegistry;' . "\n"
. 'class ' . $className . ' implements ModuleInterface {' . "\n"
. "\tpublic function getName(): string { return '{$name}'; }" . "\n"