@@ -48,10 +48,8 @@ public function add(FormField $field)
48
48
49
49
/**
50
50
* Removes a field and its children from the registry.
51
- *
52
- * @param string $name The fully qualified name of the base field
53
51
*/
54
- public function remove ($ name )
52
+ public function remove (string $ name )
55
53
{
56
54
$ segments = $ this ->getSegments ($ name );
57
55
$ target = &$ this ->fields ;
@@ -68,13 +66,11 @@ public function remove($name)
68
66
/**
69
67
* Returns the value of the field and its children.
70
68
*
71
- * @param string $name The fully qualified name of the field
72
- *
73
69
* @return mixed The value of the field
74
70
*
75
71
* @throws \InvalidArgumentException if the field does not exist
76
72
*/
77
- public function &get ($ name )
73
+ public function &get (string $ name )
78
74
{
79
75
$ segments = $ this ->getSegments ($ name );
80
76
$ target = &$ this ->fields ;
@@ -92,11 +88,9 @@ public function &get($name)
92
88
/**
93
89
* Tests whether the form has the given field.
94
90
*
95
- * @param string $name The fully qualified name of the field
96
- *
97
91
* @return bool Whether the form has the given field
98
92
*/
99
- public function has ($ name )
93
+ public function has (string $ name ): bool
100
94
{
101
95
try {
102
96
$ this ->get ($ name );
@@ -110,12 +104,11 @@ public function has($name)
110
104
/**
111
105
* Set the value of a field and its children.
112
106
*
113
- * @param string $name The fully qualified name of the field
114
- * @param mixed $value The value
107
+ * @param mixed $value The value
115
108
*
116
109
* @throws \InvalidArgumentException if the field does not exist
117
110
*/
118
- public function set ($ name , $ value )
111
+ public function set (string $ name , $ value )
119
112
{
120
113
$ target = &$ this ->get ($ name );
121
114
if ((!\is_array ($ value ) && $ target instanceof Field \FormField) || $ target instanceof Field \ChoiceFormField) {
@@ -135,7 +128,7 @@ public function set($name, $value)
135
128
*
136
129
* @return FormField[] The list of fields as [string] Fully qualified name => (mixed) value)
137
130
*/
138
- public function all ()
131
+ public function all (): array
139
132
{
140
133
return $ this ->walk ($ this ->fields , $ this ->base );
141
134
}
@@ -146,12 +139,11 @@ public function all()
146
139
* This function is made private because it allows overriding the $base and
147
140
* the $values properties without any type checking.
148
141
*
149
- * @param string $base The fully qualified name of the base field
150
- * @param array $values The values of the fields
142
+ * @param array $values The values of the fields
151
143
*
152
144
* @return static
153
145
*/
154
- private static function create ($ base , array $ values )
146
+ private static function create (string $ base , array $ values )
155
147
{
156
148
$ registry = new static ();
157
149
$ registry ->base = $ base ;
0 commit comments