8000 Fix error messages + phpdoc + CS · symfony/symfony@3124187 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3124187

Browse files
committed
Fix error messages + phpdoc + CS
1 parent d26d931 commit 3124187

File tree

3 files changed

+56
-76
lines changed

3 files changed

+56
-76
lines changed

src/Symfony/Component/Form/ButtonBuilder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,15 +515,15 @@ public function setAutoInitialize($initialize)
515515
public function setPosition($position)
516516
{
517517
if ($this->locked) {
518-
throw new BadMethodCallException('The config builder cannot be modified anymore.');
518+
throw new BadMethodCallException('ButtonBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
519519
}
520520

521-
if (is_string($position) && ($position !== 'first') && ($position !== 'last')) {
522-
throw new InvalidConfigurationException('If you use position as string, you can only use "first" & "last".');
521+
if (is_string($position) && $position !== 'first' && $position !== 'last') {
522+
throw new InvalidConfigurationException('When using position as a string, the only supported values are "first" and "last".');
523523
}
524524

525525
if (is_array($position) && !isset($position['before']) && !isset($position['after'])) {
526-
throw new InvalidConfigurationException('If you use position as array, you must at least define the "before" or "after" option.');
526+
throw new InvalidConfigurationException('When using position as an array, the "before" or "after" option must be defined.');
527527
}
528528

529529
$this->position = $position;

src/Symfony/Component/Form/FormConfigBuilder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -851,15 +851,15 @@ public function setAutoInitialize($initialize)
851851
public function setPosition($position)
852852
{
853853
if ($this->locked) {
854-
throw new BadMethodCallException('The config builder cannot be modified anymore.');
854+
throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
855855
}
856856

857857
if (is_string($position) && ($position !== 'first') && ($position !== 'last')) {
858-
throw new InvalidConfigurationException('If you use position as string, you can only use "first" & "last".');
858+
throw new InvalidConfigurationException('When using position as a string, the only supported values are "first" and "last".');
859859
}
860860

861861
if (is_array($position) && !isset($position['before']) && !isset($position['after'])) {
862-
throw new InvalidConfigurationException('If you use position as array, you must at least define the "before" or "after" option.');
862+
throw new InvalidConfigurationException('When using position as an array, the "before" or "after" option must be defined.');
863863
}
864864

865865
$this->position = $position;

src/Symfony/Component/Form/FormOrderer.php

Lines changed: 49 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -20,39 +20,20 @@
2020
*/
2121
class FormOrderer
2222
{
23-
/**
24-
* @var array
25-
*/
2623
private $weights;
27-
28-
/**
29-
* @var array
30-
*/
3124
private $deferred;
32-
33-
/**
34-
* @var int
35-
*/
3625
private $firstWeight;
37-
38-
/**
39-
* @var int
40-
*/
4126
private $currentWeight;
42-
43-
/**
44-
* @var int
45-
*/
4627
private $lastWeight;
4728

4829
/**
4930
* Orders the form.
5031
*
51-
* @param FormInterface $form The form.
32+
* @param FormInterface $form
5233
*
53-
* @return array The ordered form child names.
34+
* @return array The ordered form child names
5435
*
55-
* @throws \Symfony\Component\Form\Exception\InvalidConfigurationException If a position is not valid.
36+
* @throws InvalidConfigurationException If a position is not valid
5637
*/
5738
public function order(FormInterface $form)
5839
{
@@ -76,9 +57,9 @@ public function order(FormInterface $form)
7657
}
7758

7859
/**
79-
* Process the form using the current weight in order to maintain the default order.
60+
* Process the form using the current weight in order to maintain the default order
8061
*
81-
* @param FormInterface $form The form.
62+
* @param FormInterface $form
8263
*/
8364
private function processEmptyPosition(FormInterface $form)
8465
{
@@ -87,10 +68,10 @@ private function processEmptyPosition(FormInterface $form)
8768

8869
/**
8970
* Process the form using the current first/last weight in order to put your form at the
90-
* first/last position according to the default order.
71+
* first/last position according to the default order
9172
*
92-
* @param FormInterface $form The form.
93-
* @param string $position The position.
73+
* @param FormInterface $form
74+
* @param string $position
9475
*/
9576
private function processStringPosition(FormInterface $form, $position)
9677
{
@@ -102,12 +83,11 @@ private function processStringPosition(FormInterface $form, $position)
10283
}
10384

10485
/**
105-
* Processes an array position (before/after).
106-
*
107-
* FIXME
86+
* Process the form using the weight of the "before" or "after" form
87+
* If the "before" or "after" form has not been processed yet, we defer it for the next forms
10888
*
109-
* @param FormInterface $form The form.
110-
* @param array $position The position.
89+
* @param FormInterface $form
90+
* @param array $position
11191
*/
11292
private function processArrayPosition(FormInterface $form, array $position)
11393
{
@@ -122,9 +102,9 @@ private function processArrayPosition(FormInterface $form, array $position)
122102

123103
/**
124104
* Process the form using the current first weight in order to put
125-
* your form at the first position according to the default order.
105+
* your form at the first position according to the default order
126106
*
127-
* @param FormInterface $form The form.
107+
* @param FormInterface $form
128108
*/
129109
private function processFirst(FormInterface $form)
130110
{
@@ -133,21 +113,21 @@ private function processFirst(FormInterface $form)
133113

134114
/**
135115
* Processes the form using the current last weight in order to put
136-
* your form at the last position according to the default order.
116+
* your form at the last position according to the default order
137117
*
138-
* @param FormInterface $form The form.
118+
* @param FormInterface $form
139119
*/
140120
private function processLast(FormInterface $form)
141121
{
142122
$this->processWeight($form, $this->lastWeight + 1);
143123
}
144124

145125
/**
146-
* Process the form using the weight of the "before" form.
147-
* If the "before" form has not been processed yet, we defer it for the next forms.
126+
* Process the form using the weight of the "before" form
127+
* If the "before" form has not been processed yet, we defer it for the next forms
148128
*
149-
* @param FormInterface $form The form.
150-
* @param string $before The before form name.
129+
* @param FormInterface $form
130+
* @param string $before
151131
*/
152132
private function processBefore(FormInterface $form, $before)
153133
{
@@ -159,11 +139,11 @@ private function processBefore(FormInterface $form, $before)
159139
}
160140

161141
/**
162-
* Process the form using the weight of the "after" form.
163-
* If the "after" form has not been processed yet, we defer it for the next forms.
142+
* Process the form using the weight of the "after" form
143+
* If the "after" form has not been processed yet, we defer it for the next forms
164144
*
165-
* @param FormInterface $form The form.
166-
* @param string $after The after form name.
145+
* @param FormInterface $form
146+
* @param string $after
167147
*/
168148
private function processAfter(FormInterface $form, $after)
169149
{
@@ -175,12 +155,12 @@ private function processAfter(FormInterface $form, $after)
175155
}
176156

177157
/**
178-
* Process the form using the given weight.
158+
* Process the form using the given weight
179159
*
180-
* This method also updates the orderer state accordingly.
160+
* This method also updates the orderer state accordingly
181161
*
182-
* @param FormInterface $form The form.
183-
* @param int $weight The weight.
162+
* @param FormInterface $form
163+
* @param int $weight
184164
*/
185165
private function processWeight(FormInterface $form, $weight)
186166
{
@@ -202,13 +182,13 @@ private function processWeight(FormInterface $form, $weight)
202182

203183
/**
204184
* Finishes the form weight processing by trying to process deferred forms
205-
* which refers to the current processed form.
185+
* which refers to the current processed form
206186
*
207-
* @param FormInterface $form The form.
208-
* @param int $weight The weight.
209-
* @param string $position The position (null|before|after).
187+
* @param FormInterface $form
188+
* @param int $weight
189+
* @param string $position
210190
*
211-
* @return int The new weight.
191+
* @return int The new weight
212192
*/
213193
private function finishWeight(FormInterface $form, $weight, $position = null)
214194
{
@@ -235,13 +215,13 @@ private function finishWeight(FormInterface $form, $weight, $position = null)
235215

236216
/**
237217
* Processes a deferred form by checking if it is valid and
238-
* if it does not become a circular or symmetric ordering.
218+
* if it does not become a circular or symmetric ordering
239219
*
240-
* @param FormInterface $form The form.
241-
* @param string $deferred The deferred form name.
242-
* @param string $position The position (before|after).
220+
* @param FormInterface $form
221+
* @param string $deferred
222+
* @param string $position
243223
*
244-
* @throws InvalidConfigurationException If the deferred form does not exist.
224+
* @throws InvalidConfigurationException If the deferred form does not exist
245225
*/
246226
private function processDeferred(FormInterface $form, $deferred, $position)
247227
{
@@ -258,13 +238,13 @@ private function processDeferred(FormInterface $form, $deferred, $position)
258238
}
259239

260240
/**
261-
* Detects circular deferred forms for after/before position such as A => B => C => A.
241+
* Detects circular deferred forms for after/before position such as A => B => C => A
262242
*
263-
* @param string $name The form name.
264-
* @param string $position The position (before|after)
265-
* @param array $stack The circular stack.
243+
* @param string $name
244+
* @param string $position
245+
* @param array $stack
266246
*
267-
* @throws InvalidConfigurationException If there is a circular before/after deferred.
247+
* @throws InvalidConfigurationException If there is a circular before/after deferred
268248
*/
269249
private function detectCircularDeferred($name, $position, array $stack = array())
270250
{
@@ -288,13 +268,13 @@ private function detectCircularDeferred($name, $position, array $stack = array()
288268
}
289269

290270
/**
291-
* Detects symmetric before/after deferred such as A after B and B after A.
271+
* Detects symmetric before/after deferred such as A after B and B after A
292272
*
293-
* @param string $name The form name.
294-
* @param string $deferred The deferred form name.
295-
* @param string $position The position (before|after).
273+
* @param string $name
274+
* @param string $deferred
275+
* @param string $position
296276
*
297-
* @throws InvalidConfigurationException If there is a symetric before/after deferred.
277+
* @throws InvalidConfigurationException If there is a symetric before/after deferred
298278
*/
299279
private function detectedSymmetricDeferred($name, $deferred, $position)
300280
{
@@ -310,7 +290,7 @@ private function detectedSymmetricDeferred($name, $deferred, $position)
310290
}
311291

312292
/**
313-
* Resets the orderer.
293+
* Resets the orderer
314294
*/
315295
private function reset()
316296
{

0 commit comments

Comments
 (0)
0