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 authored and Grundik committed May 16, 2023
1 parent 04e124d commit 17ae929
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;

/**
Expand All @@ -19,14 +20,27 @@ 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('');

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;
}

/**
* {@inheritDoc} override needed to specify type in more detail
*/
Expand Down

0 comments on commit 17ae929

Please sign in to comment.