Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Application/LinkGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
1 change: 1 addition & 0 deletions src/Application/UI/ComponentReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
];
}
Expand Down
4 changes: 4 additions & 0 deletions tests/UI/ComponentReflection.getParameters().phpt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Assert::same(
'since' => 'OnePresenter',
],
'yes3' => [
'def' => null,
'type' => 'mixed',
],
],
Expand All @@ -60,9 +61,11 @@ Assert::same(
Assert::same(
[
'yes2' => [
'def' => null,
'type' => 'mixed',
],
'yes4' => [
'def' => null,
'type' => 'mixed',
],
'yes1' => [
Expand All @@ -71,6 +74,7 @@ Assert::same(
'since' => 'OnePresenter',
],
'yes3' => [
'def' => null,
'type' => 'mixed',
],
],
Expand Down
Loading