mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-09-26 04:02:51 +02:00
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:
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
use XcVm\Core\Module\ModuleLoader;
|
||||
use XcVm\Core\Module\NavbarRegistry;
|
||||
use XcVm\Core\Module\BaseModule;
|
||||
use XcVm\Core\Http\Router;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -108,7 +111,7 @@ final class ModuleLoaderPsr4ResolverTest extends TestCase {
|
||||
$namespace = 'XcVm\\Module\\' . $pascal;
|
||||
file_put_contents($dir . '/' . $cls . '.php', "<?php\n"
|
||||
. "namespace {$namespace};\n"
|
||||
. "use BaseModule;\n"
|
||||
. "use XcVm\Core\Module\BaseModule;\n"
|
||||
. "class {$cls} extends BaseModule {\n"
|
||||
. "\tpublic function getName(): string { return '{$name}'; }\n"
|
||||
. "\tpublic function getVersion(): string { return '1.0.0'; }\n"
|
||||
|
||||
Reference in New Issue
Block a user