getType()->value . "\n"; try { // Create container $container = new DefaultContainer(); $clock = new SystemClock(); $pathProvider = new PathProvider(__DIR__); $container->instance(\App\Framework\DateTime\Clock::class, $clock); $container->instance(\App\Framework\Core\PathProvider::class, $pathProvider); // Create cache (simplified) $cache = new \App\Framework\Cache\Driver\ArrayCache(); $container->instance(Cache::class, $cache); // Clear web-specific cache $defaultPaths = [$pathProvider->getSourcePath()]; $contextString = $context->getType()->value; $cacheKey = DiscoveryCacheIdentifiers::fullDiscoveryKey($defaultPaths, $contextString); echo "Clearing cache key: " . $cacheKey->toString() . "\n"; $cache->forget($cacheKey); // Force discovery rebuild $bootstrapper = new DiscoveryServiceBootstrapper($container, $clock); $registry = $bootstrapper->bootstrap(); echo "Discovery completed with " . count($registry) . " total items\n"; // Check for RequestFactory $initializers = $registry->initializers; $requestFactoryFound = false; foreach ($initializers->getAllClasses() as $className) { if (str_contains($className, 'RequestFactory')) { echo "Found RequestFactory: $className\n"; $methods = $initializers->getByClass($className); foreach ($methods as $method) { echo " Method: " . $method->method . "\n"; } $requestFactoryFound = true; } } if (!$requestFactoryFound) { echo "❌ RequestFactory initializer not found in WEB context!\n"; } else { echo "✅ RequestFactory found in web discovery\n"; } } catch (Throwable $e) { echo "ERROR: " . $e->getMessage() . "\n"; echo "FILE: " . $e->getFile() . ":" . $e->getLine() . "\n"; }