Skip to content

Commit

Permalink
Add key & value type hint to all properties of type array
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Sep 1, 2023
1 parent 638e65e commit e36d439
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 55 deletions.
50 changes: 0 additions & 50 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@ parameters:
count: 1
path: src/BaseHtmlElement.php

-
message: "#^Property ipl\\\\Html\\\\BaseHtmlElement\\:\\:\\$defaultAttributes type has no value type specified in iterable type array\\.$#"
count: 1
path: src/BaseHtmlElement.php

-
message: "#^Property ipl\\\\Html\\\\BaseHtmlElement\\:\\:\\$voidElements type has no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -180,16 +175,6 @@ parameters:
count: 1
path: src/Contract/FormElementDecorator.php

-
message: "#^Method ipl\\\\Html\\\\Contract\\\\ValueCandidates\\:\\:getValueCandidates\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Contract/ValueCandidates.php

-
message: "#^Method ipl\\\\Html\\\\Contract\\\\ValueCandidates\\:\\:setValueCandidates\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#"
count: 1
path: src/Contract/ValueCandidates.php

-
message: "#^Method ipl\\\\Html\\\\Error\\:\\:getPhpTypeName\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -280,11 +265,6 @@ parameters:
count: 1
path: src/Form.php

-
message: "#^Property ipl\\\\Html\\\\Form\\:\\:\\$populatedValues type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Form.php

-
message: "#^Property ipl\\\\Html\\\\Form\\:\\:\\$submitButton \\(ipl\\\\Html\\\\Contract\\\\FormSubmitElement\\) does not accept null\\.$#"
count: 1
Expand Down Expand Up @@ -395,11 +375,6 @@ parameters:
count: 1
path: src/FormElement/BaseFormElement.php

-
message: "#^Method ipl\\\\Html\\\\FormElement\\\\BaseFormElement\\:\\:getValueCandidates\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/FormElement/BaseFormElement.php

-
message: "#^Method ipl\\\\Html\\\\FormElement\\\\BaseFormElement\\:\\:getValueOfNameAttribute\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -430,21 +405,11 @@ parameters:
count: 1
path: src/FormElement/BaseFormElement.php

-
message: "#^Method ipl\\\\Html\\\\FormElement\\\\BaseFormElement\\:\\:setValueCandidates\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#"
count: 1
path: src/FormElement/BaseFormElement.php

-
message: "#^Parameter \\#1 \\$attributes of method ipl\\\\Html\\\\BaseHtmlElement\\:\\:addAttributes\\(\\) expects array\\|ipl\\\\Html\\\\Attributes, mixed given\\.$#"
count: 1
path: src/FormElement/BaseFormElement.php

-
message: "#^Property ipl\\\\Html\\\\FormElement\\\\BaseFormElement\\:\\:\\$valueCandidates type has no value type specified in iterable type array\\.$#"
count: 1
path: src/FormElement/BaseFormElement.php

-
message: "#^Trying to invoke mixed but it's not a callable\\.$#"
count: 1
Expand Down Expand Up @@ -500,11 +465,6 @@ parameters:
count: 1
path: src/FormElement/FieldsetElement.php

-
message: "#^Property ipl\\\\Html\\\\FormElement\\\\FieldsetElement\\:\\:\\$populatedValues type has no value type specified in iterable type array\\.$#"
count: 1
path: src/FormElement/FieldsetElement.php

-
message: "#^Cannot access offset 0 on mixed\\.$#"
count: 1
Expand Down Expand Up @@ -545,11 +505,6 @@ parameters:
count: 1
path: src/FormElement/InputElement.php

-
message: "#^Property ipl\\\\Html\\\\FormElement\\\\LocalDateTimeElement\\:\\:\\$defaultAttributes type has no value type specified in iterable type array\\.$#"
count: 1
path: src/FormElement/LocalDateTimeElement.php

-
message: "#^Method ipl\\\\Html\\\\FormElement\\\\PasswordElement\\:\\:registerAttributeCallbacks\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -640,11 +595,6 @@ parameters:
count: 1
path: src/FormElement/SubmitButtonElement.php

-
message: "#^Property ipl\\\\Html\\\\FormElement\\\\SubmitButtonElement\\:\\:\\$defaultAttributes type has no value type specified in iterable type array\\.$#"
count: 1
path: src/FormElement/SubmitButtonElement.php

-
message: "#^Property ipl\\\\Html\\\\FormElement\\\\SubmitElement\\:\\:\\$buttonLabel has no type specified\\.$#"
count: 1
Expand Down
2 changes: 1 addition & 1 deletion src/BaseHtmlElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ abstract class BaseHtmlElement extends HtmlDocument
/** @var bool|null Whether the element is void. If null, void check should use {@link $voidElements} */
protected $isVoid;

/** @var array You may want to set default attributes when extending this class */
/** @var array<string, mixed> You may want to set default attributes when extending this class */
protected $defaultAttributes;

/** @var string Tag of element. Set this property in order to provide the element's tag when extending this class */
Expand Down
4 changes: 2 additions & 2 deletions src/Contract/ValueCandidates.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ interface ValueCandidates
/**
* Get value candidates of this element
*
* @return array
* @return array<int, mixed>
*/
public function getValueCandidates();

/**
* Set value candidates of this element
*
* @param array $values
* @param array<int, mixed> $values
*
* @return $this
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FormElement/BaseFormElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ abstract class BaseFormElement extends BaseHtmlElement implements FormElement, V
/** @var mixed Value of the element */
protected $value;

/** @var array Value candidates of the element */
/** @var array<int, mixed> Value candidates of the element */
protected $valueCandidates = [];

/**
Expand Down
2 changes: 1 addition & 1 deletion src/FormElement/FormElements.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ trait FormElements
/** @var FormElement[] */
private $elements = [];

/** @var array */
/** @var array<int|string, array<int, mixed>> */
private $populatedValues = [];

/**
Expand Down

0 comments on commit e36d439

Please sign in to comment.