Skip to content

Commit 6fec32c

Browse files
Merge branch '3.4' into 4.1
* 3.4: [DI] configure inlined services before injecting them when dumping the container Consistently throw exceptions on a single line fix fopen calls Update .editorconfig
2 parents 432487f + 8bc014c commit 6fec32c

File tree

67 files changed

+314
-823
lines changed

Some content is hidden

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

67 files changed

+314
-823
lines changed

.editorconfig

Lines 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

Lines 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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,7 @@ private function resolve($value)
170170
return (string) $resolved;
171171
}
172172

173-
throw new RuntimeException(sprintf(
174-
'The container parameter "%s", used in the route configuration value "%s", '.
175-
'must be a string or numeric, but it is of type %s.',
176-
$match[1],
177-
$value,
178-
\gettype($resolved)
179-
)
180-
);
173+
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)));
181174
}, $value);
182175

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

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

Lines 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

Lines 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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,7 @@ public function getPath()
288288
final public function merge($leftSide, $rightSide)
289289
{
290290
if (!$this->allowOverwrite) {
291-
throw new ForbiddenOverwriteException(sprintf(
292-
'Configuration path "%s" cannot be overwritten. You have to '
293-
.'define all options for this path, and any of its sub-paths in '
294-
.'one configuration section.',
295-
$this->getPath()
296-
));
291+
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()));
297292
}
298293

299294
if ($leftSide !== $leftPlaceholders = self::resolvePlaceholderValue($leftSide)) {

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

Lines 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

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -468,31 +468,23 @@ protected function validateConcreteNode(ArrayNode $node)
468468
$path = $node->getPath();
469469

470470
if (null !== $this->key) {
471-
throw new InvalidDefinitionException(
472-
sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path)
473-
);
471+
throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path));
474472
}
475473

476474
if (false === $this->allowEmptyValue) {
477475
throw new InvalidDefinitionException(sprintf('->cannotBeEmpty() is not applicable to concrete nodes at path "%s"', $path));
478476
}
479477

480478
if (true === $this->atLeastOne) {
481-
throw new InvalidDefinitionException(
482-
sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s"', $path)
483-
);
479+
throw new InvalidDefinitionException(sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s"', $path));
484480
}
485481

486482
if ($this->default) {
487-
throw new InvalidDefinitionException(
488-
sprintf('->defaultValue() is not applicable to concrete nodes at path "%s"', $path)
489-
);
483+
throw new InvalidDefinitionException(sprintf('->defaultValue() is not applicable to concrete nodes at path "%s"', $path));
490484
}
491485

492486
if (false !== $this->addDefaultChildren) {
493-
throw new InvalidDefinitionException(
494-
sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s"', $path)
495-
);
487+
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s"', $path));
496488
}
497489
}
498490

@@ -506,28 +498,20 @@ protected function validatePrototypeNode(PrototypedArrayNode $node)
506498
$path = $node->getPath();
507499

508500
if ($this->addDefaults) {
509-
throw new InvalidDefinitionException(
510-
sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s"', $path)
511-
);
501+
throw new InvalidDefinitionException(sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s"', $path));
512502
}
513503

514504
if (false !== $this->addDefaultChildren) {
515505
if ($this->default) {
516-
throw new InvalidDefinitionException(
517-
sprintf('A default value and default children might not be used together at path "%s"', $path)
518-
);
506+
throw new InvalidDefinitionException(sprintf('A default value and default children might not be used together at path "%s"', $path));
519507
}
520508

521509
if (null !== $this->key && (null === $this->addDefaultChildren || \is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) {
522-
throw new InvalidDefinitionException(
523-
sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s"', $path)
524-
);
510+
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s"', $path));
525511
}
526512

527513
if (null === $this->key && (\is_string($this->addDefaultChildren) || \is_array($this->addDefaultChildren))) {
528-
throw new InvalidDefinitionException(
529-
sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s"', $path)
530-
);
514+
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s"', $path));
531515
}
532516
}
533517
}

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

Lines 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

Lines 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;

0 commit comments

Comments
 (0)