Skip to content

Commit 99a1d4c

Browse files
vudaltsovnicolas-grekas
authored andcommitted
[Form] Add parameter type declarations
1 parent 3aca99d commit 99a1d4c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+237
-383
lines changed

src/Symfony/Component/Form/AbstractExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ abstract class AbstractExtension implements FormExtensionInterface
5050
/**
5151
* {@inheritdoc}
5252
*/
53-
public function getType($name)
53+
public function getType(string $name)
5454
{
5555
if (null === $this->types) {
5656
$this->initTypes();
@@ -66,7 +66,7 @@ public function getType($name)
6666
/**
6767
* {@inheritdoc}
6868
*/
69-
public function hasType($name)
69+
public function hasType(string $name)
7070
{
7171
if (null === $this->types) {
7272
$this->initTypes();
@@ -78,7 +78,7 @@ public function hasType($name)
7878
/**
7979
* {@inheritdoc}
8080
*/
81-
public function getTypeExtensions($name)
81+
public function getTypeExtensions(string $name)
8282
{
8383
if (null === $this->typeExtensions) {
8484
$this->initTypeExtensions();
@@ -92,7 +92,7 @@ public function getTypeExtensions($name)
9292
/**
9393
* {@inheritdoc}
9494
*/
95-
public function hasTypeExtensions($name)
95+
public function hasTypeExtensions(string $name)
9696
{
9797
if (null === $this->typeExtensions) {
9898
$this->initTypeExtensions();

src/Symfony/Component/Form/AbstractRendererEngine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ abstract protected function loadResourceForBlockName(string $cacheKey, FormView
123123
*
124124
* @see getResourceForBlockHierarchy()
125125
*/
126-
private function loadResourceForBlockNameHierarchy(string $cacheKey, FormView $view, array $blockNameHierarchy, $hierarchyLevel): bool
126+
private function loadResourceForBlockNameHierarchy(string $cacheKey, FormView $view, array $blockNameHierarchy, int $hierarchyLevel): bool
127127
{
128128
$blockName = $blockNameHierarchy[$hierarchyLevel];
129129

src/Symfony/Component/Form/Button.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function getParent()
128128
*
129129
* @throws BadMethodCallException
130130
*/
131-
public function add($child, $type = null, array $options = [])
131+
public function add($child, string $type = null, array $options = [])
132132
{
133133
throw new BadMethodCallException('Buttons cannot have children.');
134134
}
@@ -138,23 +138,19 @@ public function add($child, $type = null, array $options = [])
138138
*
139139
* This method should not be invoked.
140140
*
141-
* @param string $name
142-
*
143141
* @throws BadMethodCallException
144142
*/
145-
public function get($name)
143+
public function get(string $name)
146144
{
147145
throw new BadMethodCallException('Buttons cannot have children.');
148146
}
149147

150148
/**
151149
* Unsupported method.
152150
*
153-
* @param string $name
154-
*
155151
* @return bool Always returns false
156152
*/
157-
public function has($name)
153+
public function has(string $name)
158154
{
159155
return false;
160156
}
@@ -164,11 +160,9 @@ public function has($name)
164160
*
165161
* This method should not be invoked.
166162
*
167-
* @param string $name
168-
*
169163
* @throws BadMethodCallException
170164
*/
171-
public function remove($name)
165+
public function remove(string $name)
172166
{
173167
throw new BadMethodCallException('Buttons cannot have children.');
174168
}
@@ -184,7 +178,7 @@ public function all()
184178
/**
185179
* {@inheritdoc}
186180
*/
187-
public function getErrors($deep = false, $flatten = true)
181+
public function getErrors(bool $deep = false, bool $flatten = true)
188182
{
189183
return new FormErrorIterator($this, []);
190184
}
@@ -378,7 +372,7 @@ public function handleRequest($request = null)
378372
*
379373
* @throws Exception\AlreadySubmittedException if the button has already been submitted
380374
*/
381-
public function submit($submittedData, $clearMissing = true)
375+
public function submit($submittedData, bool $clearMissing = true)
382376
{
383377
if ($this->submitted) {
384378
throw new AlreadySubmittedException('A form can only be submitted once');

0 commit comments

Comments
 (0)