Skip to content

Commit

Permalink
More type hinting
Browse files Browse the repository at this point in the history
  • Loading branch information
sdebacker committed Apr 26, 2022
1 parent 2dc5eb7 commit 5a1296f
Show file tree
Hide file tree
Showing 20 changed files with 38 additions and 134 deletions.
5 changes: 1 addition & 4 deletions src/Binding/BoundData.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

class BoundData
{
/**
* @var mixed
*/
protected $data;
protected mixed $data;

public function __construct(mixed $data)
{
Expand Down
10 changes: 2 additions & 8 deletions src/Elements/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@

class Button extends FormControl
{
/**
* @var array
*/
protected $attributes = [
protected array $attributes = [
'type' => 'button',
];

/**
* @var string
*/
protected $value;
protected string $value;

public function __construct(string $value, ?string $name = null)
{
Expand Down
15 changes: 3 additions & 12 deletions src/Elements/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,13 @@

class Checkbox extends Input
{
/**
* @var array
*/
protected $attributes = [
protected array $attributes = [
'type' => 'checkbox',
];

/**
* @var ?bool
*/
protected $checked;
protected ?bool $checked;

/**
* @var mixed
*/
protected $oldValue;
protected mixed $oldValue = null;

public function __construct(string $name, mixed $value = 1)
{
Expand Down
5 changes: 1 addition & 4 deletions src/Elements/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

class Date extends Text
{
/**
* @var array
*/
protected $attributes = [
protected array $attributes = [
'type' => 'date',
];

Expand Down
5 changes: 1 addition & 4 deletions src/Elements/DateTimeLocal.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

class DateTimeLocal extends Text
{
/**
* @var array
*/
protected $attributes = [
protected array $attributes = [
'type' => 'datetime-local',
];

Expand Down
5 changes: 1 addition & 4 deletions src/Elements/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

abstract class Element
{
/**
* @var array
*/
protected $attributes = [];
protected array $attributes = [];

protected function setAttribute(string $attribute, mixed $value = null): void
{
Expand Down
5 changes: 1 addition & 4 deletions src/Elements/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

class Email extends Text
{
/**
* @var array
*/
protected $attributes = [
protected array $attributes = [
'type' => 'email',
];
}
5 changes: 1 addition & 4 deletions src/Elements/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

class File extends Input
{
/**
* @var array
*/
protected $attributes = [
protected array $attributes = [
'type' => 'file',
];
}
15 changes: 3 additions & 12 deletions src/Elements/FormOpen.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,14 @@

class FormOpen extends Element
{
/**
* @var array
*/
protected $attributes = [
protected array $attributes = [
'method' => 'POST',
'action' => '',
];

/**
* @var ?Hidden
*/
protected $token;
protected ?Hidden $token;

/**
* @var ?Hidden
*/
protected $hiddenMethod;
protected ?Hidden $hiddenMethod;

public function render(): string
{
Expand Down
5 changes: 1 addition & 4 deletions src/Elements/Hidden.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

class Hidden extends Input
{
/**
* @var array
*/
protected $attributes = [
protected array $attributes = [
'type' => 'hidden',
];
}
19 changes: 5 additions & 14 deletions src/Elements/Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,11 @@

class Label extends Element
{
/**
* @var ?Element
*/
protected $element;

/**
* @var bool
*/
protected $labelBefore;

/**
* @var string
*/
protected $label;
protected ?Element $element = null;

protected ?bool $labelBefore = null;

protected string $label;

public function __construct(string $label)
{
Expand Down
5 changes: 1 addition & 4 deletions src/Elements/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

class Number extends Input
{
/**
* @var array
*/
protected $attributes = [
protected array $attributes = [
'type' => 'number',
];

Expand Down
5 changes: 1 addition & 4 deletions src/Elements/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

class Password extends Text
{
/**
* @var array
*/
protected $attributes = [
protected array $attributes = [
'type' => 'password',
];
}
5 changes: 1 addition & 4 deletions src/Elements/RadioButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

class RadioButton extends Checkbox
{
/**
* @var array
*/
protected $attributes = [
protected array $attributes = [
'type' => 'radio',
];

Expand Down
12 changes: 3 additions & 9 deletions src/Elements/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@

class Select extends FormControl
{
/**
* @var array
*/
protected $options;

/**
* @var ?bool
*/
protected $selected;
protected array $options;

protected mixed $selected = null;

public function __construct(string $name, array $options = [])
{
Expand Down
5 changes: 1 addition & 4 deletions src/Elements/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

class Text extends Input
{
/**
* @var array
*/
protected $attributes = [
protected array $attributes = [
'type' => 'text',
];

Expand Down
10 changes: 2 additions & 8 deletions src/Elements/TextArea.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@

class TextArea extends FormControl
{
/**
* @var array
*/
protected $attributes = [
protected array $attributes = [
'name' => '',
'rows' => 10,
'cols' => 50,
];

/**
* @var ?string
*/
protected $value;
protected ?string $value = null;

public function render(): string
{
Expand Down
5 changes: 1 addition & 4 deletions src/ErrorStore/IlluminateErrorStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@

class IlluminateErrorStore implements ErrorStoreInterface
{
/**
* @var Session
*/
private $session;
private Session $session;

public function __construct(Session $session)
{
Expand Down
26 changes: 7 additions & 19 deletions src/FormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,13 @@

class FormBuilder
{
/**
* @var ?OldInputInterface
*/
protected $oldInput;

/**
* @var ?ErrorStoreInterface
*/
protected $errorStore;

/**
* @var ?string
*/
protected $csrfToken;

/**
* @var ?\TypiCMS\Form\Binding\BoundData
*/
protected $boundData;
protected ?OldInputInterface $oldInput;

protected ?ErrorStoreInterface $errorStore;

protected ?string $csrfToken;

protected ?BoundData $boundData;

public function setOldInputProvider(OldInputInterface $oldInputProvider): void
{
Expand Down
5 changes: 1 addition & 4 deletions src/OldInput/IlluminateOldInputProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@

class IlluminateOldInputProvider implements OldInputInterface
{
/**
* @var Session
*/
private $session;
private Session $session;

public function __construct(Session $session)
{
Expand Down

0 comments on commit 5a1296f

Please sign in to comment.