Skip to content

Commit e1d7b9d

Browse files
Add types to public and protected properties
1 parent 51a1aa2 commit e1d7b9d

20 files changed

+46
-73
lines changed

AbstractRendererEngine.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,22 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface, Re
2525
*/
2626
public const CACHE_KEY_VAR = 'cache_key';
2727

28-
/**
29-
* @var array
30-
*/
31-
protected $defaultThemes;
28+
protected array $defaultThemes;
3229

3330
/**
3431
* @var array[]
3532
*/
36-
protected $themes = [];
33+
protected array $themes = [];
3734

3835
/**
3936
* @var bool[]
4037
*/
41-
protected $useDefaultThemes = [];
38+
protected array $useDefaultThemes = [];
4239

4340
/**
4441
* @var array[]
4542
*/
46-
protected $resources = [];
43+
protected array $resources = [];
4744

4845
/**
4946
* @var array<array<int|false>>

ButtonBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*/
2626
class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
2727
{
28-
protected $locked = false;
28+
protected bool $locked = false;
2929

3030
private bool $disabled = false;
3131
private ResolvedFormTypeInterface $type;

ChoiceList/ArrayChoiceList.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,18 @@
2424
*/
2525
class ArrayChoiceList implements ChoiceListInterface
2626
{
27-
/**
28-
* The choices in the list.
29-
*
30-
* @var array
31-
*/
32-
protected $choices;
27+
protected array $choices;
3328

3429
/**
3530
* The values indexed by the original keys.
36-
*
37-
* @var array
3831
*/
39-
protected $structuredValues;
32+
protected array $structuredValues;
4033

4134
/**
4235
* The original keys of the choices array.
43-
*
44-
* @var int[]|string[]
4536
*/
46-
protected $originalKeys;
47-
protected $valueCallback;
37+
protected array $originalKeys;
38+
protected ?\Closure $valueCallback = null;
4839

4940
/**
5041
* Creates a list with the given choices and values.

ChoiceList/View/ChoiceGroupView.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
*/
2121
class ChoiceGroupView implements \IteratorAggregate
2222
{
23-
public $label;
24-
public $choices;
23+
public string $label;
24+
public array $choices;
2525

2626
/**
2727
* Creates a new choice group view.

ChoiceList/View/ChoiceListView.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
*/
2323
class ChoiceListView
2424
{
25-
public $choices;
26-
public $preferredChoices;
25+
public array $choices;
26+
public array $preferredChoices;
2727

2828
/**
2929
* Creates a new choice list view.

ChoiceList/View/ChoiceView.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@
2020
*/
2121
class ChoiceView
2222
{
23-
public $label;
24-
public $value;
25-
public $data;
23+
public string|TranslatableInterface|false $label;
24+
public string $value;
25+
public mixed $data;
2626

2727
/**
2828
* Additional attributes for the HTML tag.
2929
*/
30-
public $attr;
30+
public array $attr;
3131

3232
/**
3333
* Additional parameters used to translate the label.
3434
*/
35-
public $labelTranslationParameters;
35+
public array $labelTranslationParameters;
3636

3737
/**
3838
* Creates a new choice view.

Extension/Core/DataTransformer/BaseDateTimeTransformer.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@
2121
*/
2222
abstract class BaseDateTimeTransformer implements DataTransformerInterface
2323
{
24-
protected static $formats = [
24+
protected static array $formats = [
2525
\IntlDateFormatter::NONE,
2626
\IntlDateFormatter::FULL,
2727
\IntlDateFormatter::LONG,
2828
\IntlDateFormatter::MEDIUM,
2929
\IntlDateFormatter::SHORT,
3030
];
3131

32-
protected $inputTimezone;
33-
34-
protected $outputTimezone;
32+
protected string $inputTimezone;
33+
protected string $outputTimezone;
3534

3635
/**
3736
* @param string|null $inputTimezone The name of the input timezone

Extension/Core/DataTransformer/DataTransformerChain.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
class DataTransformerChain implements DataTransformerInterface
2323
{
24-
protected $transformers;
24+
protected array $transformers;
2525

2626
/**
2727
* Uses the given value transformers to transform values.

Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@
2525
*/
2626
class NumberToLocalizedStringTransformer implements DataTransformerInterface
2727
{
28-
protected $grouping;
29-
30-
protected $roundingMode;
28+
protected bool $grouping;
29+
protected int $roundingMode;
3130

3231
private ?int $scale;
3332
private ?string $locale;

Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface
2828
public const FRACTIONAL = 'fractional';
2929
public const INTEGER = 'integer';
3030

31-
protected static $types = [
31+
protected static array $types = [
3232
self::FRACTIONAL,
3333
self::INTEGER,
3434
];

0 commit comments

Comments
 (0)