chore(psr4): phase 3 (Core hubs) — namespace Core/Module

Move Core/Module into XcVm\Core\Module (BaseModule, ModuleInterface,
MigratableInterface, ModuleLoader, ModuleManager, NavbarRegistry, NavbarItem,
CoreNavbarProvider) and Core/Module/Contract into XcVm\Core\Module\Contract
(the 6 provider interfaces). Completes the Core hub layer.

- Namespace 14 files (8 root + 6 Contract). Root files import the contracts via
  'use XcVm\Core\Module\Contract\...'; NavbarProviderInterface imports the
  root NavbarRegistry. Qualify still-global deps with leading backslash
  (\ServiceContainer, \CommandRegistry, \ModuleState, \ServerEnvironment,
  \EventDispatcher, \ListensTo, the Module exceptions, \ZipArchive,
  \InvalidArgumentException, \RuntimeException) — Container/Events/Enum/Exception
  migrate later. Migrated deps (Router, StreamPipeline, ...) keep their use.
- Rewrite the modules' 'use BaseModule/NavbarRegistry/NavbarItem;' → FQCN; add
  'use XcVm\Core\Module\...;' to other referrers across src/ and tests/.
- Fix pre-existing leading-backslash refs to the FQCN.
- Tests: qualify the module fixtures' generated 'use ModuleInterface;' /
  'use BaseModule;' / 'use NavbarRegistry;' and the registerRoutes type hint to
  FQCN; add real top-level use imports to the fixture-builder tests; update
  InterfaceContractTest registerNavbar param-type to the FQCN. Repaired
  use-inserter mis-placements in the two tests that declare a namespace() method.
- Public/index.php: class_exists('ModuleLoader') → class_exists(ModuleLoader::class).
- phpstan-baseline.neon regenerated (292→292; no new/unknown-class errors).

Verified: php -l clean; PHPStan no errors; PHPUnit 295/295; the 4 real modules
load and resolve as XcVm\Core\Module\ModuleInterface; leading-backslash
re-sweep across all migrated classes is clean.
This commit is contained in:
Divarion-D
2026-06-24 22:05:10 +03:00
parent 160adc1439
commit 881991e52b
48 changed files with 255 additions and 153 deletions
+6 -3
View File
@@ -1,6 +1,9 @@
<?php
use XcVm\Core\Http\Router;
use XcVm\Core\Module\ModuleLoader;
use XcVm\Core\Module\NavbarRegistry;
use XcVm\Core\Module\ModuleInterface;
use PHPUnit\Framework\TestCase;
// Shared tracker — loaded by PHPUnit before any module PHP file is require_once'd by ModuleLoader.
@@ -221,11 +224,11 @@ final class ModuleLoaderBootTest extends TestCase {
$code = "<?php\n"
. "namespace {$ns};\n"
. "use ModuleInterface;\n"
. "use XcVm\Core\Module\ModuleInterface;\n"
. "use ServiceContainer;\n"
. "use XcVm\\Core\\Http\\Router;\n"
. "use CommandRegistry;\n"
. "use NavbarRegistry;\n"
. "use XcVm\Core\Module\NavbarRegistry;\n"
. "class {$cls} implements ModuleInterface {\n"
. "\tpublic function getName(): string { return '{$name}'; }\n"
. "\tpublic function getVersion(): string { return '1.0.0'; }\n"
@@ -251,7 +254,7 @@ final class ModuleLoaderBootTest extends TestCase {
$code = "<?php\n"
. "namespace {$ns};\n"
. "use BaseModule;\n"
. "use XcVm\Core\Module\BaseModule;\n"
. "use ServiceContainer;\n"
. "class {$cls} extends BaseModule {\n"
. "\tpublic function getName(): string { return '{$name}'; }\n"