Skip to content

Commit 3f03051

Browse files
committed
compatibility with nette/forms 3.0
1 parent c94f654 commit 3f03051

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"conflict": {
3737
"nette/nette": "<2.2",
3838
"nette/di": "<2.4",
39-
"nette/forms": "<2.4",
39+
"nette/forms": "<3.0",
4040
"nette/latte": "<2.4"
4141
},
4242
"autoload": {

src/Application/UI/Form.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,26 +83,25 @@ protected function attached(Nette\ComponentModel\IComponent $presenter): void
8383
* Tells if the form is anchored.
8484
* @return bool
8585
*/
86-
public function isAnchored()
86+
public function isAnchored(): bool
8787
{
8888
return (bool) $this->getPresenter(FALSE);
8989
}
9090

9191

9292
/**
9393
* Internal: returns submitted HTTP data or NULL when form was not submitted.
94-
* @return array|NULL
9594
*/
96-
protected function receiveHttpData()
95+
protected function receiveHttpData(): ?array
9796
{
9897
$presenter = $this->getPresenter();
9998
if (!$presenter->isSignalReceiver($this, 'submit')) {
100-
return;
99+
return NULL;
101100
}
102101

103102
$request = $presenter->getRequest();
104103
if ($request->isMethod('forward') || $request->isMethod('post') !== $this->isMethod('post')) {
105-
return;
104+
return NULL;
106105
}
107106

108107
if ($this->isMethod('post')) {
@@ -119,7 +118,7 @@ protected function beforeRender()
119118
$key = ($this->isMethod('post') ? '_' : '') . Presenter::SIGNAL_KEY;
120119
if (!isset($this[$key])) {
121120
$do = $this->lookupPath(Presenter::class) . self::NAME_SEPARATOR . 'submit';
122-
$this[$key] = (new Nette\Forms\Controls\HiddenField($do))->setOmitted()->setHtmlId(FALSE);
121+
$this[$key] = (new Nette\Forms\Controls\HiddenField($do))->setOmitted();
123122
}
124123
}
125124

0 commit comments

Comments
 (0)