#!/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 "Checking all available attribute types..." . PHP_EOL; $attributeRegistry = $registry->attributes; $allTypes = $attributeRegistry->getAllTypes(); echo "Available attribute types: " . implode(', ', $allTypes) . PHP_EOL; echo "Total attribute count: " . $attributeRegistry->count() . PHP_EOL; foreach ($allTypes as $type) { $count = $attributeRegistry->getCount($type); echo " - {$type}: {$count} instances" . PHP_EOL; } echo PHP_EOL . "Looking specifically for ConsoleCommand attributes..." . PHP_EOL; $commands = $registry->attributes->get(ConsoleCommand::class); echo "Found " . count($commands) . " ConsoleCommand attributes" . PHP_EOL; // Check if the ConsoleCommand class name is correct echo "ConsoleCommand class name: " . ConsoleCommand::class . PHP_EOL; if (count($commands) > 0) { 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; }