diff --git a/src/Application/LinkGenerator.php b/src/Application/LinkGenerator.php index 04ff64a67..b9c46dd5a 100644 --- a/src/Application/LinkGenerator.php +++ b/src/Application/LinkGenerator.php @@ -170,6 +170,12 @@ public function createRequest( trigger_error("Link to deprecated presenter '$presenter' from '{$refPresenter->getName()}:{$refPresenter->getAction()}'.", E_USER_DEPRECATED); } + foreach (array_intersect_key($reflection->getParameters(), $args) as $name => $param) { + if ($args[$name] === $param['def']) { + $args[$name] = null; // value transmit is unnecessary + } + } + // counterpart of run() & tryCall() if ($method = $reflection->getActionRenderMethod($action)) { if ($this->isDeprecated($refPresenter, $method)) { diff --git a/src/Application/UI/ComponentReflection.php b/src/Application/UI/ComponentReflection.php index 0d2e2ad70..ee5bba57d 100644 --- a/src/Application/UI/ComponentReflection.php +++ b/src/Application/UI/ComponentReflection.php @@ -55,6 +55,7 @@ public function getParameters(): array ]; } elseif ($prop->getAttributes(Attributes\Parameter::class)) { $params[$prop->getName()] = [ + 'def' => $prop->getDefaultValue(), 'type' => (string) ($prop->getType() ?? 'mixed'), ]; } diff --git a/tests/UI/ComponentReflection.getParameters().phpt b/tests/UI/ComponentReflection.getParameters().phpt index dd0154b59..ca70724af 100644 --- a/tests/UI/ComponentReflection.getParameters().phpt +++ b/tests/UI/ComponentReflection.getParameters().phpt @@ -51,6 +51,7 @@ Assert::same( 'since' => 'OnePresenter', ], 'yes3' => [ + 'def' => null, 'type' => 'mixed', ], ], @@ -60,9 +61,11 @@ Assert::same( Assert::same( [ 'yes2' => [ + 'def' => null, 'type' => 'mixed', ], 'yes4' => [ + 'def' => null, 'type' => 'mixed', ], 'yes1' => [ @@ -71,6 +74,7 @@ Assert::same( 'since' => 'OnePresenter', ], 'yes3' => [ + 'def' => null, 'type' => 'mixed', ], ],