#!/usr/bin/env php bootstrapConsole(); echo "Getting container via reflection..." . PHP_EOL; $reflection = new ReflectionClass($consoleApp); $containerProperty = $reflection->getProperty('container'); $containerProperty->setAccessible(true); $container = $containerProperty->getValue($consoleApp); echo "Getting DiscoveryRegistry..." . PHP_EOL; $registry = $container->get(DiscoveryRegistry::class); echo "Looking for ConsoleCommand attributes..." . PHP_EOL; $commands = $registry->attributes->get(ConsoleCommand::class); echo "Found " . count($commands) . " ConsoleCommand attributes" . PHP_EOL . PHP_EOL; if (count($commands) === 0) { echo "No commands found! Let's check what's in the registry..." . PHP_EOL; // Check if registry has any attributes at all $allAttributeTypes = []; $attributesProperty = $reflection = new ReflectionClass($registry); $attributesProperty = $reflection->getProperty('attributes'); $attributesProperty->setAccessible(true); $attributesCollection = $attributesProperty->getValue($registry); echo "Registry attributes collection type: " . get_class($attributesCollection) . PHP_EOL; // Try to get all available attribute types $reflection = new ReflectionClass($attributesCollection); $dataProperty = $reflection->getProperty('data'); $dataProperty->setAccessible(true); $data = $dataProperty->getValue($attributesCollection); echo "Available attribute types: " . print_r(array_keys($data), true) . PHP_EOL; } else { foreach ($commands as $discovered) { $methodName = $discovered->methodName ? $discovered->methodName->toString() : '__invoke'; echo "- " . $discovered->className->getFullyQualified() . "::" . $methodName . PHP_EOL; $command = $discovered->createAttributeInstance(); echo " Command: " . $command->name . " - " . $command->description . PHP_EOL . PHP_EOL; } } } catch (Exception $e) { echo "Error: " . $e->getMessage() . PHP_EOL; echo "Stack trace: " . $e->getTraceAsString() . PHP_EOL; }