Skip to content

Commit 310b72f

Browse files
committed
added type hints
1 parent 20559e9 commit 310b72f

File tree

11 files changed

+12
-18
lines changed

11 files changed

+12
-18
lines changed

examples/bootstrap2-rendering.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
Debugger::enable();
1919

2020

21-
function makeBootstrap2(Form $form)
21+
function makeBootstrap2(Form $form): void
2222
{
2323
$renderer = $form->getRenderer();
2424
$renderer->wrappers['controls']['container'] = null;

examples/bootstrap3-rendering.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
Debugger::enable();
1919

2020

21-
function makeBootstrap3(Form $form)
21+
function makeBootstrap3(Form $form): void
2222
{
2323
$renderer = $form->getRenderer();
2424
$renderer->wrappers['controls']['container'] = null;

examples/bootstrap4-rendering.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
Debugger::enable();
1919

2020

21-
function makeBootstrap4(Form $form)
21+
function makeBootstrap4(Form $form): void
2222
{
2323
$renderer = $form->getRenderer();
2424
$renderer->wrappers['controls']['container'] = null;

examples/custom-control.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,7 @@ public function getControl()
106106
}
107107

108108

109-
/**
110-
* @return bool
111-
*/
112-
public static function validateDate(Nette\Forms\IControl $control)
109+
public static function validateDate(Nette\Forms\IControl $control): bool
113110
{
114111
return ctype_digit($control->day)
115112
&& ctype_digit($control->month)

examples/custom-validator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// Define custom validator
2222
class MyValidators
2323
{
24-
public static function divisibilityValidator($item, $arg)
24+
public static function divisibilityValidator($item, $arg): bool
2525
{
2626
return $item->value % $arg === 0;
2727
}

src/Bridges/FormsLatte/FormMacros.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*/
2828
class FormMacros extends MacroSet
2929
{
30-
public static function install(Latte\Compiler $compiler)
30+
public static function install(Latte\Compiler $compiler): void
3131
{
3232
$me = new static($compiler);
3333
$me->addMacro('form', [$me, 'macroForm'], 'echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack));');

src/Forms/Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ public function __call(string $name, array $args)
425425
}
426426

427427

428-
public static function extensionMethod($name, /*callable*/ $callback): void
428+
public static function extensionMethod(string $name, /*callable*/ $callback): void
429429
{
430430
if (strpos($name, '::') !== false) { // back compatibility
431431
[, $name] = explode('::', $name);

src/Forms/Controls/BaseControl.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function loadHttpData(): void
143143
* Loads HTTP data.
144144
* @return mixed
145145
*/
146-
protected function getHttpData($type, $htmlTail = null)
146+
protected function getHttpData($type, string $htmlTail = null)
147147
{
148148
return $this->getForm()->getHttpData($type, $this->getHtmlName() . $htmlTail);
149149
}
@@ -211,7 +211,7 @@ public function setDefaultValue($value)
211211
* Disables or enables control.
212212
* @return static
213213
*/
214-
public function setDisabled($value = true)
214+
public function setDisabled(/*bool*/ $value = true)
215215
{
216216
if ($this->disabled = (bool) $value) {
217217
$this->setValue(null);
@@ -587,7 +587,7 @@ public function __call(string $name, array $args)
587587
}
588588

589589

590-
public static function extensionMethod($name, /*callable*/ $callback): void
590+
public static function extensionMethod(string $name, /*callable*/ $callback): void
591591
{
592592
if (strpos($name, '::') !== false) { // back compatibility
593593
[, $name] = explode('::', $name);

src/Forms/Controls/CsrfProtection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function getToken(): string
7171
}
7272

7373

74-
private function generateToken($random = null): string
74+
private function generateToken(string $random = null): string
7575
{
7676
if ($random === null) {
7777
$random = Nette\Utils\Random::generate(10);

src/Forms/Form.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,6 @@ public function getRenderer(): IFormRenderer
580580
}
581581

582582

583-
/**
584-
* @return void
585-
*/
586583
protected function beforeRender()
587584
{
588585
}

0 commit comments

Comments
 (0)