10000 Fix some CheckStyle violations on Components. · proofek/symfony@fb0379d · GitHub
[go: up one dir, main page]

Skip to content

Commit fb0379d

Browse files
committed
Fix some CheckStyle violations on Components.
On casts, Control signature etc.
1 parent 6140869 commit fb0379d

File tree

11 files changed

+21
-26
lines changed

11 files changed

+21
-26
lines changed

src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ public function end()
8080
*/
8181
public function getNode($forceRootNode = false)
8282
{
83-
if ($forceRootNode)
84-
{
83+
if ($forceRootNode) {
8584
$this->parent = null;
8685
}
8786

src/Symfony/Component/Form/Extension/Validator/Validator/DelegatingValidator.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,24 +161,22 @@ static protected function getFormValidationGroups(FormInterface $form)
161161

162162
private function buildFormPathMapping(FormInterface $form, array &$mapping, $formPath = 'children', $namePath = '')
163163
{
164-
foreach ($form->getAttribute('error_mapping') as $nestedDataPath => $nestedNamePath)
165-
{
164+
foreach ($form->getAttribute('error_mapping') as $nestedDataPath => $nestedNamePath) {
166165
$mapping['/^'.preg_quote($formPath.'.data.'.$nestedDataPath).'(?!\w)/'] = $namePath.'.'.$nestedNamePath;
167166
}
168167

169168
$iterator = new VirtualFormAwareIterator($form->getChildren());
170169
$iterator = new \RecursiveIteratorIterator($iterator);
171170

172171
foreach ($iterator as $child) {
173-
$path = (string)$child->getAttribute('property_path');
172+
$path = (string) $child->getAttribute('property_path');
174173
$parts = explode('.', $path, 2);
175174

176175
$nestedNamePath = $namePath.'.'.$child->getName();
177176

178177
if ($child->hasChildren() || isset($parts[1])) {
179178
$nestedFormPath = $formPath.'['.trim($parts[0], '[]').']';
180-
}
181-
else {
179+
} else {
182180
$nestedFormPath = $formPath.'.data.'.$parts[0];
183181
}
184182

@@ -196,16 +194,15 @@ private function buildFormPathMapping(FormInterface $form, array &$mapping, $for
196194

197195
private function buildDataPathMapping(FormInterface $form, array &$mapping, $dataPath = 'data', $namePath = '')
198196
{
199-
foreach ($form->getAttribute('error_mapping') as $nestedDataPath => $nestedNamePath)
200-
{
197+
foreach ($form->getAttribute('error_mapping') as $nestedDataPath => $nestedNamePath) {
201198
$mapping['/^'.preg_quote($dataPath.'.'.$nestedDataPath).'(?!\w)/'] = $namePath.'.'.$nestedNamePath;
202199
}
203200

204201
$iterator = new VirtualFormAwareIterator($form->getChildren());
205202
$iterator = new \RecursiveIteratorIterator($iterator);
206203

207204
foreach ($iterator as $child) {
208-
$path = (string)$child->getAttribute('property_path');
205+
$path = (string) $child->getAttribute('property_path');
209206

210207
$nestedNamePath = $namePath.'.'.$child->getName();
211208

src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ public function guessMaxLengthForConstraint(Constraint $constraint)
278278
);
279279
case 'Symfony\Component\Validator\Constraints\Max':
280280
return new ValueGuess(
281-
strlen((string)$constraint->limit),
281+
strlen((string) $constraint->limit),
282282
Guess::HIGH_CONFIDENCE
283283
);
284284
case 'Symfony\Component\Validator\Constraints\SizeLength':
@@ -288,7 +288,7 @@ public function guessMaxLengthForConstraint(Constraint $constraint)
288288
);
289289
case 'Symfony\Component\Validator\Constraints\Size':
290290
return new ValueGuess(
291-
strlen((string)$constraint->max),
291+
strlen((string) $constraint->max),
292292
Guess::HIGH_CONFIDENCE
293293
);
294294
}
@@ -310,7 +310,7 @@ public function guessMinLengthForConstraint(Constraint $constraint)
310310
);
311311
case 'Symfony\Component\Validator\Constraints\Min':
312312
return new ValueGuess(
313-
strlen((string)$constraint->limit),
313+
strlen((string) $constraint->limit),
314314
Guess::HIGH_CONFIDENCE
315315
);
316316
case 'Symfony\Component\Validator\Constraints\SizeLength':
@@ -320,7 +320,7 @@ public function guessMinLengthForConstraint(Constraint $constraint)
320320
);
321321
case 'Symfony\Component\Validator\Constraints\Size':
322322
return new ValueGuess(
323-
strlen((string)$constraint->min),
323+
strlen((string) $constraint->min),
324324
Guess::HIGH_CONFIDENCE
325325
);
326326
}

src/Symfony/Component/Form/Util/PropertyPath.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function __construct($propertyPath)
5959
throw new InvalidPropertyPathException('The property path must not be empty');
6060
}
6161

62-
$this->string = (string)$propertyPath;
62+
$this->string = (string) $propertyPath;
6363
$position = 0;
6464
$remaining = $propertyPath;
6565

@@ -191,7 +191,7 @@ public function getValue($objectOrArray)
191191
$value = $this->readProperty($objectOrArray, $i);
192192
// arrays need to be treated separately (due to PHP bug?)
193193
// http://bugs.php.net/bug.php?id=52133
194-
} else if (is_array($objectOrArray)){
194+
} else if (is_array($objectOrArray)) {
195195
$property = $this->elements[$i];
196196
if (!array_key_exists($property, $objectOrArray)) {
197197
$objectOrArray[$property] = $i + 1 < $this->length ? array() : null;

src/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private function getContent($exception)
115115
$content .= sprintf('at %s%s%s()', $this->abbrClass($trace['class']), $trace['type'], $trace['function']);
116116
}
117117
if (isset($trace['file']) && isset($trace['line'])) {
118-
if ($linkFormat = ini_get('xdebug.file_link_format')) {
118+
if ($linkFormat = ini_get('xdebug.file_link_format')) {
119119
$link = str_replace(array('%f', '%l'), array($trace['file'], $trace['line']), $linkFormat);
120120
$content .= sprintf(' in <a href="%s" title="Go to source">%s line %s</a>', $link, $trace['file'], $trace['line']);
121121
} else {

src/Symfony/Component/Locale/Locale.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static public function getIcuVersion()
178178

179179
try {
180180
$reflector = new \ReflectionExtension('intl');
181-
} catch(\ReflectionException $e) {
181+
} catch (\ReflectionException $e) {
182182
return;
183183
}
184184

@@ -203,7 +203,7 @@ static public function getIcuDataVersion()
203203

204204
try {
205205
$reflector = new \ReflectionExtension('intl');
206-
} catch(\ReflectionException $e) {
206+
} catch (\ReflectionException $e) {
207207
return;
208208
}
209209

src/Symfony/Component/Locale/Stub/DateFormat/MonthTransformer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ public function extractDateOptions($matched, $length)
133133
// IntlDateFormatter::parse() always returns false for MMMMM or LLLLL
134134
$matched = false;
135135
}
136-
}
137-
else {
136+
} else {
138137
$matched = (int) $matched;
139138
}
140139

src/Symfony/Component/Serializer/Encoder/XmlEncoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ private function parseXml($node)
190190

191191
if ($key === 'item') {
192192
if (isset($value['@key'])) {
193-
$data[(string)$value['@key']] = $value['#'];
193+
$data[(string) $value['@key']] = $value['#'];
194194
} elseif (isset($data['item'])) {
195195
$tmp = $data['item'];
196196
unset($data['item']);

src/Symfony/Component/Translation/Extractor/ChainExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function addExtractor($format, ExtractorInterface $extractor)
4343
*/
4444
public function setPrefix($prefix)
4545
{
46-
foreach($this->extractors as $extractor){
46+
foreach ($this->extractors as $extractor) {
4747
$extractor->setPrefix($prefix);
4848
}
4949
}

src/Symfony/Component/Translation/Loader/CsvFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ public function load($resource, $locale, $domain = 'messages')
4141

4242
try {
4343
$file = new \SplFileObject($resource, 'rb');
44-
} catch(\RuntimeException $e) {
44+
} catch (\RuntimeException $e) {
4545
throw new \InvalidArgumentException(sprintf('Error opening file "%s".', $resource));
4646
}
4747

4848
$file->setFlags(\SplFileObject::READ_CSV | \SplFileObject::SKIP_EMPTY);
4949
$file-& 2851 gt;setCsvControl($this->delimiter, $this->enclosure, $this->escape);
5050

51-
foreach($file as $data) {
51+
foreach ($file as $data) {
5252
if (substr($data[0], 0, 1) === '#') {
5353
continue;
5454
}

0 commit comments

Comments
 (0)
0