Skip to content

Commit 05259e7

Browse files
committed
Presenter::argsToParams() object parameters are required too (BC break)
1 parent 08982cf commit 05259e7

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Application/UI/Presenter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ public static function argsToParams($class, $method, & $args, $supplemental = []
10291029
}
10301030

10311031
if (!isset($args[$name])) {
1032-
if ($param->isDefaultValueAvailable() || $type === 'NULL' || $type === 'array' || $isClass) {
1032+
if ($param->isDefaultValueAvailable() || $type === 'NULL' || $type === 'array') {
10331033
continue;
10341034
}
10351035
throw new InvalidLinkException("Missing parameter \$$name required by $class::{$rm->getName()}()");

tests/UI/Presenter.link().php7.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ class TestPresenter extends Application\UI\Presenter
187187
Assert::same('#error: Argument $arr passed to TestPresenter::actionDefaults() must be array, string given.', $this->link('defaults', ['int' => '1', 'bool' => '1', 'str' => '', 'arr' => '']));
188188

189189
Assert::same('/index.php?action=objects&presenter=Test', $this->link('objects', ['req' => new stdClass, 'opt' => new stdClass]));
190-
Assert::same('/index.php?action=objects&presenter=Test', $this->link('objects', []));
191-
Assert::same('/index.php?action=objects&presenter=Test', $this->link('objects', ['req' => NULL, 'opt' => NULL]));
190+
Assert::same('#error: Missing parameter $req required by TestPresenter::actionObjects()', $this->link('objects', []));
191+
Assert::same('#error: Missing parameter $req required by TestPresenter::actionObjects()', $this->link('objects', ['req' => NULL, 'opt' => NULL]));
192192
Assert::same('#error: Argument $req passed to TestPresenter::actionObjects() must be stdClass, Exception given.', $this->link('objects', ['req' => new Exception, 'opt' => NULL]));
193193
Assert::same('#error: Argument $req passed to TestPresenter::actionObjects() must be stdClass, array given.', $this->link('objects', ['req' => []]));
194194

tests/UI/Presenter.link().phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ class TestPresenter extends Application\UI\Presenter
155155
Assert::same('#error: Argument $arr passed to TestPresenter::actionDefaults() must be array, string given.', $this->link('defaults', ['int' => '1', 'bool' => '1', 'str' => '', 'arr' => '']));
156156

157157
Assert::same('/index.php?action=objects&presenter=Test', $this->link('objects', ['req' => new stdClass, 'opt' => new stdClass]));
158-
Assert::same('/index.php?action=objects&presenter=Test', $this->link('objects', []));
159-
Assert::same('/index.php?action=objects&presenter=Test', $this->link('objects', ['req' => NULL, 'opt' => NULL]));
158+
Assert::same('#error: Missing parameter $req required by TestPresenter::actionObjects()', $this->link('objects', []));
159+
Assert::same('#error: Missing parameter $req required by TestPresenter::actionObjects()', $this->link('objects', ['req' => NULL, 'opt' => NULL]));
160160
Assert::same('#error: Argument $req passed to TestPresenter::actionObjects() must be stdClass, Exception given.', $this->link('objects', ['req' => new Exception, 'opt' => NULL]));
161161
Assert::same('#error: Argument $req passed to TestPresenter::actionObjects() must be stdClass, array given.', $this->link('objects', ['req' => []]));
162162

0 commit comments

Comments
 (0)