Commit c1cb8424 authored by catch's avatar catch
Browse files

Issue #3125234 by martin107, longwave: ProxyBuilder compatibility with Symfony 5

(cherry picked from commit 66e8d084)
parent 0d208056
......@@ -236,6 +236,9 @@ protected function buildMethod(\ReflectionMethod $reflection_method) {
$signature_line .= implode(', ', $parameters);
$signature_line .= ')';
if ($reflection_method->hasReturnType()) {
$signature_line .= ': ' . $reflection_method->getReturnType()->getName();
}
$output = $signature_line . "\n{\n";
......@@ -265,6 +268,9 @@ protected function buildParameter(\ReflectionParameter $parameter) {
elseif ($class = $parameter->getClass()) {
$parameter_string .= '\\' . $class->getName() . ' ';
}
elseif ($parameter->hasType()) {
$parameter_string .= $parameter->getType()->getName() . ' ';
}
if ($parameter->isPassedByReference()) {
$parameter_string .= '&';
......
......@@ -133,8 +133,8 @@ public function testBuildComplexMethod() {
/**
* {@inheritdoc}
*/
public function complexMethod($parameter, callable $function, \Drupal\Tests\Component\ProxyBuilder\TestServiceNoMethod $test_service = NULL, array &$elements = array (
))
public function complexMethod(string $parameter, callable $function, \Drupal\Tests\Component\ProxyBuilder\TestServiceNoMethod $test_service = NULL, array &$elements = array (
)): array
{
return $this->lazyLoadItself()->complexMethod($parameter, $function, $test_service, $elements);
}
......@@ -381,7 +381,7 @@ public function methodWithParameter($parameter) {
class TestServiceComplexMethod {
public function complexMethod($parameter, callable $function, TestServiceNoMethod $test_service = NULL, array &$elements = []) {
public function complexMethod(string $parameter, callable $function, TestServiceNoMethod $test_service = NULL, array &$elements = []): array {
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment