Skip to content

Commit 5f291ad

Browse files
committed
More type hinting
1 parent 4756d19 commit 5f291ad

12 files changed

Lines changed: 35 additions & 98 deletions

src/BasicFormBuilder.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313

1414
class BasicFormBuilder
1515
{
16-
/**
17-
* @var FormBuilder
18-
*/
19-
protected $builder;
16+
protected FormBuilder $builder;
2017

2118
public function __construct(FormBuilder $builder)
2219
{

src/BootForm.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,11 @@
66

77
class BootForm
88
{
9-
/**
10-
* @var BasicFormBuilder
11-
*/
12-
protected $builder;
13-
14-
/**
15-
* @var BasicFormBuilder
16-
*/
17-
protected $basicFormBuilder;
18-
19-
/**
20-
* @var HorizontalFormBuilder
21-
*/
22-
protected $horizontalFormBuilder;
9+
protected BasicFormBuilder $builder;
10+
11+
protected BasicFormBuilder $basicFormBuilder;
12+
13+
protected HorizontalFormBuilder $horizontalFormBuilder;
2314

2415
public function __construct(BasicFormBuilder $basicFormBuilder, HorizontalFormBuilder $horizontalFormBuilder)
2516
{

src/BootFormsServiceProvider.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010

1111
class BootFormsServiceProvider extends ServiceProvider implements DeferrableProvider
1212
{
13-
/**
14-
* Register the service provider.
15-
*/
1613
public function register()
1714
{
1815
$this->registerErrorStore();

src/Elements/CheckGroup.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,9 @@
77

88
class CheckGroup extends FormGroup
99
{
10-
protected $label;
11-
12-
/**
13-
* BootForm implementation.
14-
*
15-
* @var \TypiCMS\Form\Elements\Element
16-
*/
17-
protected $control;
10+
protected Label $label;
11+
12+
protected Element $control;
1813

1914
public function __construct(Label $label, Element $control)
2015
{

src/Elements/FormGroup.php

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,13 @@
77

88
class FormGroup extends Element
99
{
10-
/**
11-
* @var Label
12-
*/
13-
protected $label;
14-
15-
/**
16-
* @var \TypiCMS\Form\Elements\Element
17-
*/
18-
protected $control;
19-
20-
/**
21-
* @var ?FormText
22-
*/
23-
protected $formText;
24-
25-
/**
26-
* @var ?InvalidFeedback
27-
*/
28-
protected $invalidFeedback;
10+
protected Label $label;
11+
12+
protected Element $control;
13+
14+
protected ?FormText $formText = null;
15+
16+
protected ?InvalidFeedback $invalidFeedback = null;
2917

3018
public function __construct(Label $label, Element $control)
3119
{

src/Elements/FormText.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66

77
class FormText extends Element
88
{
9-
/**
10-
* @var string
11-
*/
12-
private $message;
9+
private string $message;
1310

1411
public function __construct(string $message)
1512
{

src/Elements/GroupWrapper.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22

33
namespace TypiCMS\BootForms\Elements;
44

5+
use TypiCMS\Form\Elements\Element;
6+
57
class GroupWrapper
68
{
7-
/**
8-
* @var FormGroup
9-
*/
10-
protected $formGroup;
11-
12-
/**
13-
* @var \TypiCMS\Form\Elements\Element
14-
*/
15-
protected $target;
9+
protected FormGroup $formGroup;
10+
11+
protected Element $target;
1612

1713
public function __construct(FormGroup $formGroup)
1814
{

src/Elements/HorizontalFormGroup.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77

88
class HorizontalFormGroup extends FormGroup
99
{
10-
/**
11-
* @var array
12-
*/
13-
protected $controlSizes;
10+
protected array $controlSizes;
1411

1512
public function __construct(Label $label, Element $control, array $controlSizes)
1613
{

src/Elements/InputGroup.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,9 @@
66

77
class InputGroup extends Text
88
{
9-
/**
10-
* @var array
11-
*/
12-
protected $beforeAddon = [];
9+
protected array $beforeAddon = [];
1310

14-
/**
15-
* @var array
16-
*/
17-
protected $afterAddon = [];
11+
protected array $afterAddon = [];
1812

1913
public function beforeAddon(string $addon): self
2014
{
@@ -37,7 +31,7 @@ public function type(string $type): self
3731
return $this;
3832
}
3933

40-
protected function renderAddons(array $addons, string $class): string
34+
protected function renderAddons(array $addons): string
4135
{
4236
$html = '';
4337

@@ -51,9 +45,9 @@ protected function renderAddons(array $addons, string $class): string
5145
public function render(): string
5246
{
5347
$html = '<div class="input-group">';
54-
$html .= $this->renderAddons($this->beforeAddon, 'prepend');
48+
$html .= $this->renderAddons($this->beforeAddon);
5549
$html .= parent::render();
56-
$html .= $this->renderAddons($this->afterAddon, 'append');
50+
$html .= $this->renderAddons($this->afterAddon);
5751
$html .= '</div>';
5852

5953
return $html;

src/Elements/InvalidFeedback.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66

77
class InvalidFeedback extends Element
88
{
9-
/**
10-
* @var string
11-
*/
12-
private $message;
9+
private string $message;
1310

1411
public function __construct(string $message)
1512
{

0 commit comments

Comments
 (0)