- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
80 lines
2.9 KiB
PHP
80 lines
2.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
|
|
|
use App\Framework\Discovery\Processing\ClassExtractor;
|
|
use App\Framework\Discovery\Processing\ProcessingContext;
|
|
use App\Framework\Discovery\ValueObjects\FileContext;
|
|
use App\Framework\Filesystem\File;
|
|
use App\Framework\Filesystem\FileSystemService;
|
|
use App\Framework\Reflection\CachedReflectionProvider;
|
|
|
|
try {
|
|
echo "=== Discovery Pipeline Debug Test ===\n";
|
|
|
|
$testFile = '/var/www/html/src/Framework/Discovery/Commands/ClearDiscoveryCache.php';
|
|
echo "Testing file: $testFile\n";
|
|
|
|
// Create file system service
|
|
$fileSystemService = new FileSystemService();
|
|
|
|
// Create file object using static factory method
|
|
$fileInfo = new \SplFileInfo($testFile);
|
|
$file = File::fromSplFileInfo($fileInfo);
|
|
echo "File created: " . $file->getPath() . "\n";
|
|
|
|
// Test ClassExtractor
|
|
$classExtractor = new ClassExtractor($fileSystemService);
|
|
$classNames = $classExtractor->extractFromFile($file);
|
|
|
|
echo "Classes extracted: " . count($classNames) . "\n";
|
|
foreach ($classNames as $className) {
|
|
echo " - " . $className->getFullyQualified() . "\n";
|
|
}
|
|
|
|
// Test FileContext creation (like FileStreamProcessor does)
|
|
$fileContext = FileContext::fromFile($file)->withClassNames($classNames);
|
|
|
|
// Test ProcessingContext
|
|
$reflectionProvider = new CachedReflectionProvider();
|
|
$processingContext = new ProcessingContext($reflectionProvider);
|
|
|
|
echo "FileContext created\n";
|
|
echo "FileContext class names: " . count($fileContext->getClassNames()) . "\n";
|
|
foreach ($fileContext->getClassNames() as $className) {
|
|
echo " - " . $className->getFullyQualified() . "\n";
|
|
|
|
// Test reflection
|
|
$reflection = $processingContext->getReflection($className);
|
|
if ($reflection === null) {
|
|
echo " ERROR: No reflection found for class\n";
|
|
} else {
|
|
echo " Reflection OK: " . $reflection->getName() . "\n";
|
|
|
|
// Check methods
|
|
$methods = $reflection->getMethods();
|
|
echo " Methods: " . count($methods) . "\n";
|
|
|
|
foreach ($methods as $method) {
|
|
$attributes = $method->getAttributes();
|
|
if (count($attributes) > 0) {
|
|
echo " Method {$method->getName()} has " . count($attributes) . " attributes:\n";
|
|
foreach ($attributes as $attr) {
|
|
echo " - " . $attr->getName() . "\n";
|
|
if ($attr->getName() === 'App\\Framework\\Console\\ConsoleCommand') {
|
|
echo " FOUND CONSOLE COMMAND ATTRIBUTE!\n";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
} catch (\Throwable $e) {
|
|
echo "ERROR: " . $e->getMessage() . "\n";
|
|
echo "File: " . $e->getFile() . ":" . $e->getLine() . "\n";
|
|
echo "Trace:\n" . $e->getTraceAsString() . "\n";
|
|
}
|