Pass original class name in AspectContext
This commit is contained in:
parent
6946059f07
commit
0c34664aef
1 changed files with 5 additions and 4 deletions
|
|
@ -179,12 +179,13 @@ class AspectWeaver
|
|||
array $methodAspectsMap,
|
||||
string $modifiedSource
|
||||
): string {
|
||||
$originalClassName = $namespace ? "{$namespace}\\{$shortName}" : $shortName;
|
||||
$code = "<?php\n\n";
|
||||
$code .= trim($modifiedSource) . "\n\n";
|
||||
$code .= "class {$shortName} extends {$renamedClassName}\n{\n";
|
||||
|
||||
foreach ($methodAspectsMap as $methodMetadata) {
|
||||
$code .= $this->generateProxyMethodFromReflection($methodMetadata->method, $methodMetadata->aspects);
|
||||
$code .= $this->generateProxyMethodFromReflection($methodMetadata->method, $methodMetadata->aspects, $originalClassName);
|
||||
}
|
||||
|
||||
$code .= "}\n";
|
||||
|
|
@ -201,6 +202,7 @@ class AspectWeaver
|
|||
string $renamedClassName,
|
||||
array $methodAspectsMap
|
||||
): string {
|
||||
$originalClassName = $namespace ? "{$namespace}\\{$shortName}" : $shortName;
|
||||
$code = '';
|
||||
|
||||
if ($namespace) {
|
||||
|
|
@ -210,7 +212,7 @@ class AspectWeaver
|
|||
$code .= "class {$shortName} extends {$renamedClassName}\n{\n";
|
||||
|
||||
foreach ($methodAspectsMap as $methodMetadata) {
|
||||
$code .= $this->generateProxyMethodFromReflection($methodMetadata->method, $methodMetadata->aspects);
|
||||
$code .= $this->generateProxyMethodFromReflection($methodMetadata->method, $methodMetadata->aspects, $originalClassName);
|
||||
}
|
||||
|
||||
$code .= "}\n";
|
||||
|
|
@ -221,13 +223,12 @@ class AspectWeaver
|
|||
/**
|
||||
* @param array<int, AttributeMetadata> $aspects
|
||||
*/
|
||||
private function generateProxyMethodFromReflection(ReflectionMethod $method, array $aspects): string
|
||||
private function generateProxyMethodFromReflection(ReflectionMethod $method, array $aspects, string $className): string
|
||||
{
|
||||
$visibility = $method->isPublic() ? 'public' : 'protected';
|
||||
$static = $method->isStatic() ? 'static ' : '';
|
||||
$isStatic = $method->isStatic();
|
||||
$name = $method->getName();
|
||||
$className = $method->getDeclaringClass()->getName();
|
||||
|
||||
$this->logger->info('Generating proxy method', [
|
||||
'class' => $className,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue