Skip to content

Commit 5fa881e

Browse files
committed
fix PHPStan and deprecations
1 parent f6d3982 commit 5fa881e

File tree

4 files changed

+27
-28
lines changed

4 files changed

+27
-28
lines changed

.phpstan.neon

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
11
includes:
22
- vendor/phpstan/phpstan-nette/extension.neon
33
- vendor/phpstan/phpstan-nette/rules.neon
4-
5-
parameters:
6-
ignoreErrors:
7-
-
8-
# https://github.com/phpstan/phpstan/issues/2063
9-
message: '/^Ternary operator condition is always true\.$/'
10-
path: %currentWorkingDirectory%/src/LatteMacros/BaseInputMacros.php

src/Renderers/Bs3FormRenderer.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
namespace Nextras\FormsRendering\Renderers;
1111

12+
use Nette\Forms\Control;
1213
use Nette\Forms\Controls;
1314
use Nette\Forms\Form;
14-
use Nette\Forms\IControl;
1515
use Nette\Forms\Rendering\DefaultFormRenderer;
1616
use Nette\Utils\Html;
1717

@@ -21,7 +21,7 @@
2121
*/
2222
class Bs3FormRenderer extends DefaultFormRenderer
2323
{
24-
/** @var Controls\Button */
24+
/** @var Controls\Button|null */
2525
public $primaryButton = null;
2626

2727
/** @var bool */
@@ -80,7 +80,7 @@ public function renderControls($parent): string
8080
}
8181

8282

83-
public function renderPair(IControl $control): string
83+
public function renderPair(Control $control): string
8484
{
8585
$this->controlsInit();
8686
return parent::renderPair($control);
@@ -94,21 +94,21 @@ public function renderPairMulti(array $controls): string
9494
}
9595

9696

97-
public function renderLabel(IControl $control): Html
97+
public function renderLabel(Control $control): Html
9898
{
9999
$this->controlsInit();
100100
return parent::renderLabel($control);
101101
}
102102

103103

104-
public function renderControl(IControl $control): Html
104+
public function renderControl(Control $control): Html
105105
{
106106
$this->controlsInit();
107107
return parent::renderControl($control);
108108
}
109109

110110

111-
private function controlsInit()
111+
private function controlsInit(): void
112112
{
113113
if ($this->controlsInit) {
114114
return;
@@ -130,7 +130,7 @@ private function controlsInit()
130130
$control->getControlPrototype()->addClass('form-control');
131131
} elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
132132
if ($control instanceof Controls\Checkbox) {
133-
$control->getSeparatorPrototype()->setName('div')->appendAttribute('class', $control->getControlPrototype()->type);
133+
$control->getContainerPrototype()->setName('div')->appendAttribute('class', $control->getControlPrototype()->type);
134134
} else {
135135
$control->getItemLabelPrototype()->addClass($control->getControlPrototype()->type . '-inline');
136136
}

src/Renderers/Bs4FormRenderer.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
namespace Nextras\FormsRendering\Renderers;
1111

12+
use Nette\Forms\Control;
1213
use Nette\Forms\Controls;
1314
use Nette\Forms\Form;
14-
use Nette\Forms\IControl;
1515
use Nette\Forms\Rendering\DefaultFormRenderer;
1616
use Nette\Utils\Html;
1717

@@ -21,7 +21,7 @@
2121
*/
2222
class Bs4FormRenderer extends DefaultFormRenderer
2323
{
24-
/** @var Controls\Button */
24+
/** @var Controls\Button|null */
2525
public $primaryButton;
2626

2727
/** @var bool */
@@ -31,7 +31,10 @@ class Bs4FormRenderer extends DefaultFormRenderer
3131
private $layout;
3232

3333

34-
public function __construct($layout = FormLayout::HORIZONTAL)
34+
/**
35+
* @param FormLayout::* $layout
36+
*/
37+
public function __construct(string $layout = FormLayout::HORIZONTAL)
3538
{
3639
$this->layout = $layout;
3740

@@ -98,7 +101,7 @@ public function renderControls($parent): string
98101
}
99102

100103

101-
public function renderPair(IControl $control): string
104+
public function renderPair(Control $control): string
102105
{
103106
$this->controlsInit();
104107
return parent::renderPair($control);
@@ -112,21 +115,21 @@ public function renderPairMulti(array $controls): string
112115
}
113116

114117

115-
public function renderLabel(IControl $control): Html
118+
public function renderLabel(Control $control): Html
116119
{
117120
$this->controlsInit();
118121
return parent::renderLabel($control);
119122
}
120123

121124

122-
public function renderControl(IControl $control): Html
125+
public function renderControl(Control $control): Html
123126
{
124127
$this->controlsInit();
125128
return parent::renderControl($control);
126129
}
127130

128131

129-
private function controlsInit()
132+
private function controlsInit(): void
130133
{
131134
if ($this->controlsInit) {
132135
return;

src/Renderers/Bs5FormRenderer.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
namespace Nextras\FormsRendering\Renderers;
1111

12+
use Nette\Forms\Control;
1213
use Nette\Forms\Controls;
1314
use Nette\Forms\Form;
14-
use Nette\Forms\IControl;
1515
use Nette\Forms\Rendering\DefaultFormRenderer;
1616
use Nette\Utils\Html;
1717

@@ -21,7 +21,7 @@
2121
*/
2222
class Bs5FormRenderer extends DefaultFormRenderer
2323
{
24-
/** @var Controls\Button */
24+
/** @var Controls\Button|null */
2525
public $primaryButton;
2626

2727
/** @var bool */
@@ -31,7 +31,10 @@ class Bs5FormRenderer extends DefaultFormRenderer
3131
private $layout;
3232

3333

34-
public function __construct($layout = FormLayout::HORIZONTAL)
34+
/**
35+
* @param FormLayout::* $layout
36+
*/
37+
public function __construct(string $layout = FormLayout::HORIZONTAL)
3538
{
3639
$this->layout = $layout;
3740

@@ -100,7 +103,7 @@ public function renderControls($parent): string
100103
}
101104

102105

103-
public function renderPair(IControl $control): string
106+
public function renderPair(Control $control): string
104107
{
105108
$this->controlsInit();
106109
return parent::renderPair($control);
@@ -114,21 +117,21 @@ public function renderPairMulti(array $controls): string
114117
}
115118

116119

117-
public function renderLabel(IControl $control): Html
120+
public function renderLabel(Control $control): Html
118121
{
119122
$this->controlsInit();
120123
return parent::renderLabel($control);
121124
}
122125

123126

124-
public function renderControl(IControl $control): Html
127+
public function renderControl(Control $control): Html
125128
{
126129
$this->controlsInit();
127130
return parent::renderControl($control);
128131
}
129132

130133

131-
private function controlsInit()
134+
private function controlsInit(): void
132135
{
133136
if ($this->controlsInit) {
134137
return;

0 commit comments

Comments
 (0)