Enable Discovery debug logging for production troubleshooting

- Add DISCOVERY_LOG_LEVEL=debug
- Add DISCOVERY_SHOW_PROGRESS=true
- Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
2025-08-11 20:13:26 +02:00
parent 59fd3dd3b1
commit 55a330b223
3683 changed files with 2956207 additions and 16948 deletions

View File

@@ -4,62 +4,84 @@ declare(strict_types=1);
namespace App\Framework\Reflection;
use ReflectionMethod;
use ReflectionAttribute;
use App\Framework\Core\ValueObjects\ClassName;
use App\Framework\Reflection\Cache\MethodCache;
use App\Framework\Reflection\Collections\AttributeCollection;
use App\Framework\Reflection\Collections\ParameterCollection;
use App\Framework\Reflection\Support\AttributeHandler;
final readonly class WrappedReflectionMethod
{
private AttributeHandler $attributeHandler;
public function __construct(
public ReflectionMethod $reflection
) {}
private ClassName $className,
private string $methodName,
private MethodCache $cache
) {
$this->attributeHandler = new AttributeHandler();
}
public function getDeclaringClass(): ClassName
{
return $this->className;
}
public function getName(): string
{
return $this->reflection->getName();
return $this->methodName;
}
public function getWrappedParameters(): array
public function getParameters(): ParameterCollection
{
return array_map(
fn($param) => new WrappedReflectionParameter($param),
$this->reflection->getParameters()
);
return $this->cache->getMethodParameters($this->className, $this->methodName);
}
/**
* @deprecated Use getParameters() instead
*/
public function getWrappedParameters(): ParameterCollection
{
return $this->getParameters();
}
// Erweiterte Parameter-Info als Array (für DI)
public function getParameterInfo(): array
{
$params = [];
foreach ($this->reflection->getParameters() as $param) {
$type = $param->getType();
$params[] = [
'name' => $param->getName(),
'type' => $type ? $type->getName() : null,
'isBuiltin' => $type ? $type->isBuiltin() : true,
'allowsNull' => $param->allowsNull(),
'isOptional' => $param->isOptional(),
'hasDefaultValue' => $param->isDefaultValueAvailable(),
'default' => $param->isDefaultValueAvailable() ? $param->getDefaultValue() : null,
'position' => $param->getPosition(),
];
}
return $params;
return $this->cache->getParameterInfo($this->className, $this->methodName);
}
public function getAttributes(?string $attributeClass = null): AttributeCollection
{
return $this->cache->getMethodAttributes($this->className, $this->methodName, $attributeClass);
}
public function getAttributeInstances(?string $attributeClass = null): array
{
$attributes = $this->reflection->getAttributes($attributeClass);
return array_map(fn(ReflectionAttribute $attr) => $attr->newInstance(), $attributes);
$attributes = $this->cache->getMethodAttributes($this->className, $this->methodName, $attributeClass);
return $this->attributeHandler->getInstances($attributes);
}
public function hasAttribute(string $attributeClass): bool
{
return !empty($this->reflection->getAttributes($attributeClass));
$attributes = $this->cache->getMethodAttributes($this->className, $this->methodName, $attributeClass);
return $this->attributeHandler->hasAny($attributes);
}
public function getFirstAttribute(string $attributeClass): ?object
{
$instances = $this->getAttributeInstances($attributeClass);
return $instances[0] ?? null;
$attributes = $this->cache->getMethodAttributes($this->className, $this->methodName, $attributeClass);
return $this->attributeHandler->getFirst($attributes);
}
/**
* Get return type name for method
*/
public function getReturnType(): ?string
{
return $this->cache->getReturnType($this->className, $this->methodName);
}
}