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
+1 -1
View File
@@ -229,7 +229,7 @@ final class ModuleLoaderBootTest extends TestCase {
. "use XcVm\Core\Module\ModuleInterface;\n"
. "use XcVm\Core\Container\ServiceContainer;\n"
. "use XcVm\\Core\\Http\\Router;\n"
. "use CommandRegistry;\n"
. "use XcVm\Cli\CommandRegistry;\n"
. "use XcVm\Core\Module\NavbarRegistry;\n"
. "class {$cls} implements ModuleInterface {\n"
. "\tpublic function getName(): string { return '{$name}'; }\n"