createForDevelopment([$srcPath]); echo "Starting full discovery scan using DiscoveryServiceFactory...\n"; $registry = $discoveryService->discover(); echo "Discovery completed!\n\n"; // Analyze registry completeness echo "=== Registry Analysis ===\n"; echo "Total items in registry: " . count($registry) . "\n"; echo "Is empty: " . ($registry->isEmpty() ? 'Yes' : 'No') . "\n\n"; // Check individual registries echo "=== Individual Registry Stats ===\n"; echo "Attributes: " . count($registry->attributes) . " items\n"; echo "Interfaces: " . count($registry->interfaces) . " items\n"; echo "Routes: " . count($registry->routes) . " items\n"; echo "Templates: " . count($registry->templates) . " items\n\n"; // Check specific attribute types echo "=== Attribute Type Analysis ===\n"; $attributeTypes = $registry->attributes->getAllTypes(); echo "Total attribute types found: " . count($attributeTypes) . "\n\n"; foreach ($attributeTypes as $type) { $count = $registry->attributes->getCount($type); $shortType = substr(strrchr($type, '\\'), 1) ?: $type; echo "- $shortType: $count items\n"; } // Focus on Initializer specifically echo "\n=== Initializer Analysis ===\n"; $initializerClass = Initializer::class; $initializerMappings = $registry->attributes->get($initializerClass); echo "Initializer attribute class: $initializerClass\n"; echo "Found initializers: " . count($initializerMappings) . "\n\n"; if (empty($initializerMappings)) { echo "āŒ No initializers found! Checking alternative lookups...\n"; // Try different class name formats $alternativeNames = [ 'App\\Framework\\DI\\Initializer', 'App\\\\Framework\\\\DI\\\\Initializer', '\\App\\Framework\\DI\\Initializer', ]; foreach ($alternativeNames as $altName) { $altMappings = $registry->attributes->get($altName); echo "- $altName: " . count($altMappings) . " items\n"; } echo "\nAll available attribute types:\n"; foreach ($attributeTypes as $type) { echo "- $type\n"; } } else { echo "āœ… Initializers found! Showing first 5:\n"; for ($i = 0; $i < min(5, count($initializerMappings)); $i++) { $mapping = $initializerMappings[$i]; $className = $mapping->class->getShortName(); $methodName = $mapping->method ? $mapping->method->toString() : '(class-level)'; echo "- $className::$methodName\n"; } } // Memory stats echo "\n=== Memory Statistics ===\n"; $memStats = $registry->getMemoryStats(); echo "Total estimated memory: " . number_format($memStats['total_estimated_bytes']) . " bytes\n"; echo "Attributes memory: " . $memStats['attributes']['memory_footprint'] . "\n"; // Check if registry got optimized $registry->optimize(); echo "\nāœ… Registry analysis completed!\n"; } catch (Exception $e) { echo "āŒ Error: " . $e->getMessage() . "\n"; echo "Stack trace:\n" . $e->getTraceAsString() . "\n"; }