Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8bc014c

Browse filesBrowse files
Merge branch '2.8' into 3.4
* 2.8: Consistently throw exceptions on a single line fix fopen calls Update .editorconfig
2 parents 5e237db + f408a67 commit 8bc014c
Copy full SHA for 8bc014c

File tree

Expand file treeCollapse file tree

61 files changed

+130
-537
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

61 files changed

+130
-537
lines changed

‎.editorconfig

Copy file name to clipboardExpand all lines: .editorconfig
+10-1Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@ root = true
33

44
; Unix-style newlines
55
[*]
6+
charset = utf-8
67
end_of_line = LF
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
710

8-
[*.php]
11+
[*.{php,html,twig}]
912
indent_style = space
1013
indent_size = 4
14+
15+
[*.md]
16+
max_line_length = 80
17+
18+
[COMMIT_EDITMSG]
19+
max_line_length = 0

‎src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,7 @@ public function configureOptions(OptionsResolver $resolver)
202202
$em = $this->registry->getManagerForClass($options['class']);
203203

204204
if (null === $em) {
205-
throw new RuntimeException(sprintf(
206-
'Class "%s" seems not to be a managed Doctrine entity. '.
207-
'Did you forget to map it?',
208-
$options['class']
209-
));
205+
throw new RuntimeException(sprintf('Class "%s" seems not to be a managed Doctrine entity. Did you forget to map it?', $options['class']));
210206
}
211207

212208
return $em;

‎src/Symfony/Bundle/FrameworkBundle/Routing/Router.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Routing/Router.php
+1-8Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,7 @@ private function resolve($value)
159159
return (string) $resolved;
160160
}
161161

162-
throw new RuntimeException(sprintf(
163-
'The container parameter "%s", used in the route configuration value "%s", '.
164-
'must be a string or numeric, but it is of type %s.',
165-
$match[1],
166-
$value,
167-
\gettype($resolved)
168-
)
169-
);
162+
throw new RuntimeException(sprintf('The container parameter "%s", used in the route configuration value "%s", must be a string or numeric, but it is of type %s.', $match[1], $value, \gettype($resolved)));
170163
}, $value);
171164

172165
return str_replace('%%', '%', $escapedValue);

‎src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php
+2-8Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,7 @@ private function determineEntryPoint($defaultEntryPointId, array $config)
9797
if ($defaultEntryPointId) {
9898
// explode if they've configured the entry_point, but there is already one
9999
if ($config['entry_point']) {
100-
throw new \LogicException(sprintf(
101-
'The guard authentication provider cannot use the "%s" entry_point because another entry point is already configured by another provider! Either remove the other provider or move the entry_point configuration as a root key under your firewall (i.e. at the same level as "guard").',
102-
$config['entry_point']
103-
));
100+
throw new \LogicException(sprintf('The guard authentication provider cannot use the "%s" entry_point because another entry point is already configured by another provider! Either remove the other provider or move the entry_point configuration as a root key under your firewall (i.e. at the same level as "guard").', $config['entry_point']));
104101
}
105102

106103
return $defaultEntryPointId;
@@ -118,9 +115,6 @@ private function determineEntryPoint($defaultEntryPointId, array $config)
118115
}
119116

120117
// we have multiple entry points - we must ask them to configure one
121-
throw new \LogicException(sprintf(
122-
'Because you have multiple guard configurators, you need to set the "guard.entry_point" key to one of your configurators (%s)',
123-
implode(', ', $authenticatorIds)
124-
));
118+
throw new \LogicException(sprintf('Because you have multiple guard configurators, you need to set the "guard.entry_point" key to one of your configurators (%s)', implode(', ', $authenticatorIds)));
125119
}
126120
}

‎src/Symfony/Component/Config/Definition/ArrayNode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Definition/ArrayNode.php
+5-18Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,13 @@ public function addChild(NodeInterface $node)
219219
protected function finalizeValue($value)
220220
{
221221
if (false === $value) {
222-
$msg = sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value));
223-
throw new UnsetKeyException($msg);
222+
throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value)));
224223
}
225224

226225
foreach ($this->children as $name => $child) {
227226
if (!array_key_exists($name, $value)) {
228227
if ($child->isRequired()) {
229-
$msg = sprintf('The child node "%s" at path "%s" must be configured.', $name, $this->getPath());
230-
$ex = new InvalidConfigurationException($msg);
228+
$ex = new InvalidConfigurationException(sprintf('The child node "%s" at path "%s" must be configured.', $name, $this->getPath()));
231229
$ex->setPath($this->getPath());
232230

233231
throw $ex;
@@ -264,11 +262,7 @@ protected function finalizeValue($value)
264262
protected function validateType($value)
265263
{
266264
if (!\is_array($value) && (!$this->allowFalse || false !== $value)) {
267-
$ex = new InvalidTypeException(sprintf(
268-
'Invalid type for path "%s". Expected array, but got %s',
269-
$this->getPath(),
270-
\gettype($value)
271-
));
265+
$ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected array, but got %s', $this->getPath(), \gettype($value)));
272266
if ($hint = $this->getInfo()) {
273267
$ex->addHint($hint);
274268
}
@@ -307,8 +301,7 @@ protected function normalizeValue($value)
307301

308302
// if extra fields are present, throw exception
309303
if (\count($value) && !$this->ignoreExtraKeys) {
310-
$msg = sprintf('Unrecognized option%s "%s" under "%s"', 1 === \count($value) ? '' : 's', implode(', ', array_keys($value)), $this->getPath());
311-
$ex = new InvalidConfigurationException($msg);
304+
$ex = new InvalidConfigurationException(sprintf('Unrecognized option%s "%s" under "%s"', 1 === \count($value) ? '' : 's', implode(', ', array_keys($value)), $this->getPath()));
312305
$ex->setPath($this->getPath());
313306

314307
throw $ex;
@@ -365,13 +358,7 @@ protected function mergeValues($leftSide, $rightSide)
365358
// no conflict
366359
if (!array_key_exists($k, $leftSide)) {
367360
if (!$this->allowNewKeys) {
368-
$ex = new InvalidConfigurationException(sprintf(
369-
'You are not allowed to define new elements for path "%s". '
370-
.'Please define all elements for this path in one config file. '
371-
.'If you are trying to overwrite an element, make sure you redefine it '
372-
.'with the same name.',
373-
$this->getPath()
374-
));
361+
$ex = new InvalidConfigurationException(sprintf('You are not allowed to define new elements for path "%s". Please define all elements for this path in one config file. If you are trying to overwrite an element, make sure you redefine it with the same name.', $this->getPath()));
375362
$ex->setPath($this->getPath());
376363

377364
throw $ex;

‎src/Symfony/Component/Config/Definition/BaseNode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Definition/BaseNode.php
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,7 @@ public function getPath()
242242
final public function merge($leftSide, $rightSide)
243243
{
244244
if (!$this->allowOverwrite) {
245-
throw new ForbiddenOverwriteException(sprintf(
246-
'Configuration path "%s" cannot be overwritten. You have to '
247-
.'define all options for this path, and any of its sub-paths in '
248-
.'one configuration section.',
249-
$this->getPath()
250-
));
245+
throw new ForbiddenOverwriteException(sprintf('Configuration path "%s" cannot be overwritten. You have to define all options for this path, and any of its sub-paths in one configuration section.', $this->getPath()));
251246
}
252247

253248
$this->validateType($leftSide);

‎src/Symfony/Component/Config/Definition/BooleanNode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Definition/BooleanNode.php
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ class BooleanNode extends ScalarNode
2626
protected function validateType($value)
2727
{
2828
if (!\is_bool($value)) {
29-
$ex = new InvalidTypeException(sprintf(
30-
'Invalid type for path "%s". Expected boolean, but got %s.',
31-
$this->getPath(),
32-
\gettype($value)
33-
));
29+
$ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected boolean, but got %s.', $this->getPath(), \gettype($value)));
3430
if ($hint = $this->getInfo()) {
3531
$ex->addHint($hint);
3632
}

‎src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php
+8-24Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -472,31 +472,23 @@ protected function validateConcreteNode(ArrayNode $node)
472472
$path = $node->getPath();
473473

474474
if (null !== $this->key) {
475-
throw new InvalidDefinitionException(
476-
sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path)
477-
);
475+
throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path));
478476
}
479477

480478
if (false === $this->allowEmptyValue) {
481479
@trigger_error(sprintf('->cannotBeEmpty() is not applicable to concrete nodes at path "%s". In 4.0 it will throw an exception.', $path), E_USER_DEPRECATED);
482480
}
483481

484482
if (true === $this->atLeastOne) {
485-
throw new InvalidDefinitionException(
486-
sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s"', $path)
487-
);
483+
throw new InvalidDefinitionException(sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s"', $path));
488484
}
489485

490486
if ($this->default) {
491-
throw new InvalidDefinitionException(
492-
sprintf('->defaultValue() is not applicable to concrete nodes at path "%s"', $path)
493-
);
487+
throw new InvalidDefinitionException(sprintf('->defaultValue() is not applicable to concrete nodes at path "%s"', $path));
494488
}
495489

496490
if (false !== $this->addDefaultChildren) {
497-
throw new InvalidDefinitionException(
498-
sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s"', $path)
499-
);
491+
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s"', $path));
500492
}
501493
}
502494

@@ -510,28 +502,20 @@ protected function validatePrototypeNode(PrototypedArrayNode $node)
510502
$path = $node->getPath();
511503

512504
if ($this->addDefaults) {
513-
throw new InvalidDefinitionException(
514-
sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s"', $path)
515-
);
505+
throw new InvalidDefinitionException(sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s"', $path));
516506
}
517507

518508
if (false !== $this->addDefaultChildren) {
519509
if ($this->default) {
520-
throw new InvalidDefinitionException(
521-
sprintf('A default value and default children might not be used together at path "%s"', $path)
522-
);
510+
throw new InvalidDefinitionException(sprintf('A default value and default children might not be used together at path "%s"', $path));
523511
}
524512

525513
if (null !== $this->key && (null === $this->addDefaultChildren || \is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) {
526-
throw new InvalidDefinitionException(
527-
sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s"', $path)
528-
);
514+
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s"', $path));
529515
}
530516

531517
if (null === $this->key && (\is_string($this->addDefaultChildren) || \is_array($this->addDefaultChildren))) {
532-
throw new InvalidDefinitionException(
533-
sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s"', $path)
534-
);
518+
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s"', $path));
535519
}
536520
}
537521
}

‎src/Symfony/Component/Config/Definition/EnumNode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Definition/EnumNode.php
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ protected function finalizeValue($value)
4343
$value = parent::finalizeValue($value);
4444

4545
if (!\in_array($value, $this->values, true)) {
46-
$ex = new InvalidConfigurationException(sprintf(
47-
'The value %s is not allowed for path "%s". Permissible values: %s',
48-
json_encode($value),
49-
$this->getPath(),
50-
implode(', ', array_map('json_encode', $this->values))));
46+
$ex = new InvalidConfigurationException(sprintf('The value %s is not allowed for path "%s". Permissible values: %s', json_encode($value), $this->getPath(), implode(', ', array_map('json_encode', $this->values))));
5147
$ex->setPath($this->getPath());
5248

5349
throw $ex;

‎src/Symfony/Component/Config/Definition/PrototypedArrayNode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Definition/PrototypedArrayNode.php
+5-13Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,7 @@ public function addChild(NodeInterface $node)
185185
protected function finalizeValue($value)
186186
{
187187
if (false === $value) {
188-
$msg = sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value));
189-
throw new UnsetKeyException($msg);
188+
throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value)));
190189
}
191190

192191
foreach ($value as $k => $v) {
@@ -199,8 +198,7 @@ protected function finalizeValue($value)
199198
}
200199

201200
if (\count($value) < $this->minNumberOfElements) {
202-
$msg = sprintf('The path "%s" should have at least %d element(s) defined.', $this->getPath(), $this->minNumberOfElements);
203-
$ex = new InvalidConfigurationException($msg);
201+
$ex = new InvalidConfigurationException(sprintf('The path "%s" should have at least %d element(s) defined.', $this->getPath(), $this->minNumberOfElements));
204202
$ex->setPath($this->getPath());
205203

206204
throw $ex;
@@ -232,8 +230,7 @@ protected function normalizeValue($value)
232230
foreach ($value as $k => $v) {
233231
if (null !== $this->keyAttribute && \is_array($v)) {
234232
if (!isset($v[$this->keyAttribute]) && \is_int($k) && !$isAssoc) {
235-
$msg = sprintf('The attribute "%s" must be set for path "%s".', $this->keyAttribute, $this->getPath());
236-
$ex = new InvalidConfigurationException($msg);
233+
$ex = new InvalidConfigurationException(sprintf('The attribute "%s" must be set for path "%s".', $this->keyAttribute, $this->getPath()));
237234
$ex->setPath($this->getPath());
238235

239236
throw $ex;
@@ -262,8 +259,7 @@ protected function normalizeValue($value)
262259
}
263260

264261
if (array_key_exists($k, $normalized)) {
265-
$msg = sprintf('Duplicate key "%s" for path "%s".', $k, $this->getPath());
266-
$ex = new DuplicateKeyException($msg);
262+
$ex = new DuplicateKeyException(sprintf('Duplicate key "%s" for path "%s".', $k, $this->getPath()));
267263
$ex->setPath($this->getPath());
268264

269265
throw $ex;
@@ -314,11 +310,7 @@ protected function mergeValues($leftSide, $rightSide)
314310
// no conflict
315311
if (!array_key_exists($k, $leftSide)) {
316312
if (!$this->allowNewKeys) {
317-
$ex = new InvalidConfigurationException(sprintf(
318-
'You are not allowed to define new elements for path "%s". '.
319-
'Please define all elements for this path in one config file.',
320-
$this->getPath()
321-
));
313+
$ex = new InvalidConfigurationException(sprintf('You are not allowed to define new elements for path "%s". Please define all elements for this path in one config file.', $this->getPath()));
322314
$ex->setPath($this->getPath());
323315

324316
throw $ex;

‎src/Symfony/Component/Config/Definition/ScalarNode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Definition/ScalarNode.php
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ class ScalarNode extends VariableNode
3333
protected function validateType($value)
3434
{
3535
if (!is_scalar($value) && null !== $value) {
36-
$ex = new InvalidTypeException(sprintf(
37-
'Invalid type for path "%s". Expected scalar, but got %s.',
38-
$this->getPath(),
39-
\gettype($value)
40-
));
36+
$ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected scalar, but got %s.', $this->getPath(), \gettype($value)));
4137
if ($hint = $this->getInfo()) {
4238
$ex->addHint($hint);
4339
}

‎src/Symfony/Component/Config/Definition/VariableNode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Definition/VariableNode.php
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,7 @@ protected function validateType($value)
8282
protected function finalizeValue($value)
8383
{
8484
if (!$this->allowEmptyValue && $this->isValueEmpty($value)) {
85-
$ex = new InvalidConfigurationException(sprintf(
86-
'The path "%s" cannot contain an empty value, but got %s.',
87-
$this->getPath(),
88-
json_encode($value)
89-
));
85+
$ex = new InvalidConfigurationException(sprintf('The path "%s" cannot contain an empty value, but got %s.', $this->getPath(), json_encode($value)));
9086
if ($hint = $this->getInfo()) {
9187
$ex->addHint($hint);
9288
}

‎src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php
+4-20Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,7 @@ public function setForeground($color = null)
9090
}
9191

9292
if (!isset(static::$availableForegroundColors[$color])) {
93-
throw new InvalidArgumentException(sprintf(
94-
'Invalid foreground color specified: "%s". Expected one of (%s)',
95-
$color,
96-
implode(', ', array_keys(static::$availableForegroundColors))
97-
));
93+
throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors))));
9894
}
9995

10096
$this->foreground = static::$availableForegroundColors[$color];
@@ -116,11 +112,7 @@ public function setBackground($color = null)
116112
}
117113

118114
if (!isset(static::$availableBackgroundColors[$color])) {
119-
throw new InvalidArgumentException(sprintf(
120-
'Invalid background color specified: "%s". Expected one of (%s)',
121-
$color,
122-
implode(', ', array_keys(static::$availableBackgroundColors))
123-
));
115+
throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors))));
124116
}
125117

126118
$this->background = static::$availableBackgroundColors[$color];
@@ -136,11 +128,7 @@ public function setBackground($color = null)
136128
public function setOption($option)
137129
{
138130
if (!isset(static::$availableOptions[$option])) {
139-
throw new InvalidArgumentException(sprintf(
140-
'Invalid option specified: "%s". Expected one of (%s)',
141-
$option,
142-
implode(', ', array_keys(static::$availableOptions))
143-
));
131+
throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
144132
}
145133

146134
if (!\in_array(static::$availableOptions[$option], $this->options)) {
@@ -158,11 +146,7 @@ public function setOption($option)
158146
public function unsetOption($option)
159147
{
160148
if (!isset(static::$availableOptions[$option])) {
161-
throw new InvalidArgumentException(sprintf(
162-
'Invalid option specified: "%s". Expected one of (%s)',
163-
$option,
164-
implode(', ', array_keys(static::$availableOptions))
165-
));
149+
throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
166150
}
167151

168152
$pos = array_search(static::$availableOptions[$option], $this->options);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.