Skip to content

Commit

Permalink
Fix generating proxies for arguments promoted as properties
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed May 16, 2023
1 parent 70d9e16 commit 3ca65b8
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/ProxyManager/Generator/MethodGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Laminas\Code\Generator\DocBlockGenerator;
use Laminas\Code\Generator\MethodGenerator as LaminasMethodGenerator;
use Laminas\Code\Generator\ParameterGenerator;
use Laminas\Code\Reflection\MethodReflection;
use ReflectionException;
use ReflectionMethod;
Expand All @@ -23,7 +24,7 @@ class MethodGenerator extends LaminasMethodGenerator
public static function fromReflectionWithoutBodyAndDocBlock(MethodReflection $reflectionMethod): self
{
/** @var static $method */
$method = parent::copyMethodSignature($reflectionMethod);
$method = static::copyMethodSignature($reflectionMethod);

$method->setInterface(false);
$method->setBody('');
Expand Down Expand Up @@ -55,6 +56,19 @@ public static function fromReflectionWithoutBodyAndDocBlock(MethodReflection $re
return $method;
}

public static function copyMethodSignature(MethodReflection $reflectionMethod): parent
{
$method = parent::copyMethodSignature($reflectionMethod);

foreach ($reflectionMethod->getParameters() as $reflectionParameter) {
$method->setParameter(
ParameterGenerator::fromReflection($reflectionParameter)
);
}

return $method;
}

public function getDocBlock(): ?DocBlockGenerator
{
$docBlock = parent::getDocBlock();
Expand Down

0 comments on commit 3ca65b8

Please sign in to comment.