Skip to content

Commit 1943c26

Browse files
committed
Merge branch '3.1' into 3.2
* 3.1: Write an exception message in a one heading line [Finder] Refine phpdoc about argument for NumberComparator Fixed max width from ajax request url element (td) Fix unresolved parameters from default bundle configs in debug:config [github] Tweak PR template [Serializer] Optimize max depth checking
2 parents 25c0103 + ed73b0c commit 1943c26

File tree

6 files changed

+34
-33
lines changed

6 files changed

+34
-33
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
| Q | A
22
| ------------- | ---
3-
| Branch? | "master" for new features / 2.7, 2.8 or 3.1 for fixes
3+
| Branch? | master / 2.7, 2.8, 3.1 or 3.2 <!--see comment below-->
44
| Bug fix? | yes/no
55
| New feature? | yes/no
66
| BC breaks? | yes/no
77
| Deprecations? | yes/no
88
| Tests pass? | yes/no
9-
| Fixed tickets | comma-separated list of tickets fixed by the PR, if any
9+
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
1010
| License | MIT
11-
| Doc PR | reference to the documentation PR, if any
11+
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
12+
13+
<!--
14+
- Bug fixes must be submitted against the lowest branch where they apply
15+
(lowest branches are regularly merged to upper ones so they get the fixes too).
16+
- Features and deprecations must be submitted against the master branch.
17+
- Please fill in this template according to the PR you're about to submit.
18+
- Replace this comment by a description of what your PR is solving.
19+
-->

src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
105105

106106
$io->title(sprintf('Current configuration for "%s.%s"', $extensionAlias, $path));
107107

108-
$io->writeln(Yaml::dump($config, 10));
108+
$io->writeln(Yaml::dump($container->getParameterBag()->resolveValue($config), 10));
109109
}
110110

111111
private function compileContainer()

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.html.twig

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
<div class="text-exception">
1010
<div class="open-quote">“</div>
1111

12-
<h1>
13-
{{ exception.message|nl2br|format_file_from_text }}
14-
</h1>
12+
<h1>{{ exception.message|nl2br|format_file_from_text }}</h1>
1513

1614
<div>
1715
<strong>{{ status_code }}</strong> {{ status_text }} - {{ exception.class|abbr_class }}

src/Symfony/Component/Finder/Comparator/NumberComparator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class NumberComparator extends Comparator
3737
/**
3838
* Constructor.
3939
*
40-
* @param string $test A comparison string
40+
* @param string|int $test A comparison string or an integer
4141
*
4242
* @throws \InvalidArgumentException If the test is not understood
4343
*/

src/Symfony/Component/Finder/Finder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function files()
111111
* $finder->depth('> 1') // the Finder will start matching at level 1.
112112
* $finder->depth('< 3') // the Finder will descend at most 3 levels of directories below the starting point.
113113
*
114-
* @param int $level The depth level expression
114+
* @param string|int $level The depth level expression
115115
*
116116
* @return Finder|SplFileInfo[] The current Finder instance
117117
*
@@ -283,7 +283,7 @@ public function notPath($pattern)
283283
* $finder->size('<= 1Ki');
284284
* $finder->size(4);
285285
*
286-
* @param string $size A size range string
286+
* @param string|int $size A size range string or an integer
287287
*
288288
* @return Finder|SplFileInfo[] The current Finder instance
289289
*

src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
1818
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
1919
use Symfony\Component\PropertyInfo\Type;
20+
use Symfony\Component\Serializer\Mapping\AttributeMetadataInterface;
2021
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
2122
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
2223

@@ -67,9 +68,10 @@ public function normalize($object, $format = null, array $context = array())
6768
$stack = array();
6869
$attributes = $this->getAttributes($object, $format, $context);
6970
$class = get_class($object);
71+
$attributesMetadata = $this->classMetadataFactory ? $this->classMetadataFactory->getMetadataFor($class)->getAttributesMetadata() : null;
7072

7173
foreach ($attributes as $attribute) {
72-
if ($this->isMaxDepthReached($class, $attribute, $context)) {
74+
if (null !== $attributesMetadata && $this->isMaxDepthReached($attributesMetadata, $class, $attribute, $context)) {
7375
continue;
7476
}
7577

@@ -289,42 +291,35 @@ private function updateData(array $data, $attribute, $attributeValue)
289291
/**
290292
* Is the max depth reached for the given attribute?
291293
*
292-
* @param string $class
293-
* @param string $attribute
294-
* @param array $context
294+
* @param AttributeMetadataInterface[] $attributesMetadata
295+
* @param string $class
296+
* @param string $attribute
297+
* @param array $context
295298
*
296299
* @return bool
297300
*/
298-
private function isMaxDepthReached($class, $attribute, array &$context)
301+
private function isMaxDepthReached(array $attributesMetadata, $class, $attribute, array &$context)
299302
{
300-
if (!$this->classMetadataFactory || !isset($context[static::ENABLE_MAX_DEPTH])) {
303+
if (
304+
!isset($context[static::ENABLE_MAX_DEPTH]) ||
305+
!isset($attributesMetadata[$attribute]) ||
306+
null === $maxDepth = $attributesMetadata[$attribute]->getMaxDepth()
307+
) {
301308
return false;
302309
}
303310

304-
$classMetadata = $this->classMetadataFactory->getMetadataFor($class);
305-
$attributesMetadata = $classMetadata->getAttributesMetadata();
306-
307-
if (!isset($attributesMetadata[$attribute])) {
308-
return false;
309-
}
311+
$key = sprintf(static::DEPTH_KEY_PATTERN, $class, $attribute);
312+
if (!isset($context[$key])) {
313+
$context[$key] = 1;
310314

311-
$maxDepth = $attributesMetadata[$attribute]->getMaxDepth();
312-
if (null === $maxDepth) {
313315
return false;
314316
}
315317

316-
$key = sprintf(static::DEPTH_KEY_PATTERN, $class, $attribute);
317-
$keyExist = isset($context[$key]);
318-
319-
if ($keyExist && $context[$key] === $maxDepth) {
318+
if ($context[$key] === $maxDepth) {
320319
return true;
321320
}
322321

323-
if ($keyExist) {
324-
++$context[$key];
325-
} else {
326-
$context[$key] = 1;
327-
}
322+
++$context[$key];
328323

329324
return false;
330325
}

0 commit comments

Comments
 (0)