Skip to content

Commit 440675f

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: fix compatibility with Twig 3.10 [Strings][EnglishInflector] Fix incorrect pluralisation of 'Album' handle union and intersection types for cascaded validations move wiring of the property info extractor to the ObjectNormalizer restore deprecated properties move Process component dep to require-dev Remove calls to `onConsecutiveCalls()` fix: remove unwanted type cast accept AbstractAsset instances when filtering schemas better distinguish URL schemes and windows drive letters handle edge cases when constructing constraints with named arguments convert empty CSV header names into numeric keys
2 parents 89b8498 + 84061f1 commit 440675f

File tree

52 files changed

+547
-219
lines changed

Some content is hidden

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

52 files changed

+547
-219
lines changed

src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineOpenTransactionLoggerMiddlewareTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testMiddlewareWrapsInTransactionAndFlushes()
5353
{
5454
$this->connection->expects($this->exactly(1))
5555
->method('isTransactionActive')
56-
->will($this->onConsecutiveCalls(true, true, false))
56+
->willReturn(true, true, false)
5757
;
5858

5959
$this->middleware->handle(new Envelope(new \stdClass()), $this->getStackMock());

src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,7 @@ public function testVerbosityChanged()
111111
$output
112112
->expects($this->exactly(2))
113113
->method('getVerbosity')
114-
->willReturnOnConsecutiveCalls(
115-
OutputInterface::VERBOSITY_QUIET,
116-
OutputInterface::VERBOSITY_DEBUG
117-
)
114+
->willReturn(OutputInterface::VERBOSITY_QUIET, OutputInterface::VERBOSITY_DEBUG)
118115
;
119116
$handler = new ConsoleHandler($output);
120117
$this->assertFalse($handler->isHandling(RecordFactory::create(Level::Notice)),

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,18 +1912,19 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
19121912
$container->setParameter('serializer.default_context', $defaultContext);
19131913
}
19141914

1915+
$arguments = $container->getDefinition('serializer.normalizer.object')->getArguments();
1916+
$context = [];
1917+
19151918
if (isset($config['circular_reference_handler']) && $config['circular_reference_handler']) {
1916-
$arguments = $container->getDefinition('serializer.normalizer.object')->getArguments();
1917-
$context = ($arguments[6] ?? $defaultContext) + ['circular_reference_handler' => new Reference($config['circular_reference_handler'])];
1919+
$context += ($arguments[6] ?? $defaultContext) + ['circular_reference_handler' => new Reference($config['circular_reference_handler'])];
19181920
$container->getDefinition('serializer.normalizer.object')->setArgument(5, null);
1919-
$container->getDefinition('serializer.normalizer.object')->setArgument(6, $context);
19201921
}
19211922

19221923
if ($config['max_depth_handler'] ?? false) {
1923-
$arguments = $container->getDefinition('serializer.normalizer.object')->getArguments();
1924-
$context = ($arguments[6] ?? $defaultContext) + ['max_depth_handler' => new Reference($config['max_depth_handler'])];
1925-
$container->getDefinition('serializer.normalizer.object')->setArgument(6, $context);
1924+
$context += ($arguments[6] ?? $defaultContext) + ['max_depth_handler' => new Reference($config['max_depth_handler'])];
19261925
}
1926+
1927+
$container->getDefinition('serializer.normalizer.object')->setArgument(6, $context);
19271928
}
19281929

19291930
private function registerPropertyInfoConfiguration(ContainerBuilder $container, PhpFileLoader $loader): void

src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@
128128
service('property_info')->ignoreOnInvalid(),
129129
service('serializer.mapping.class_discriminator_resolver')->ignoreOnInvalid(),
130130
null,
131+
null,
132+
service('property_info')->ignoreOnInvalid(),
131133
])
132134
->tag('serializer.normalizer', ['priority' => -1000])
133135

@@ -139,7 +141,6 @@
139141
service('serializer.mapping.class_discriminator_resolver')->ignoreOnInvalid(),
140142
null,
141143
[],
142-
service('property_info')->ignoreOnInvalid(),
143144
])
144145

145146
->set('serializer.denormalizer.array', ArrayDenormalizer::class)

src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ protected function getLoader()
272272
$loader
273273
->expects($this->exactly(7))
274274
->method('load')
275-
->willReturnOnConsecutiveCalls(
275+
->willReturn(
276276
$this->getCatalogue('fr', [
277277
'foo' => 'foo (FR)',
278278
]),

src/Symfony/Bundle/WebProfilerBundle/Tests/Twig/WebProfilerExtensionTest.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Bundle\WebProfilerBundle\Twig\WebProfilerExtension;
1616
use Symfony\Component\VarDumper\Cloner\VarCloner;
1717
use Twig\Environment;
18+
use Twig\Loader\ArrayLoader;
1819

1920
class WebProfilerExtensionTest extends TestCase
2021
{
@@ -23,7 +24,7 @@ class WebProfilerExtensionTest extends TestCase
2324
*/
2425
public function testDumpHeaderIsDisplayed(string $message, array $context, bool $dump1HasHeader, bool $dump2HasHeader)
2526
{
26-
$twigEnvironment = $this->mockTwigEnvironment();
27+
$twigEnvironment = new Environment(new ArrayLoader());
2728
$varCloner = new VarCloner();
2829

2930
$webProfilerExtension = new WebProfilerExtension();
@@ -44,13 +45,4 @@ public static function provideMessages(): iterable
4445
yield ['Some message {foo}', ['foo' => 'foo', 'bar' => 'bar'], true, false];
4546
yield ['Some message {foo}', ['bar' => 'bar'], false, true];
4647
}
47-
48-
private function mockTwigEnvironment()
49-
{
50-
$twigEnvironment = $this->createMock(Environment::class);
51-
52-
$twigEnvironment->expects($this->any())->method('getCharset')->willReturn('UTF-8');
53-
54-
return $twigEnvironment;
55-
}
5648
}

src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Twig\Extension\EscaperExtension;
1818
use Twig\Extension\ProfilerExtension;
1919
use Twig\Profiler\Profile;
20+
use Twig\Runtime\EscaperRuntime;
2021
use Twig\TwigFunction;
2122

2223
/**
@@ -108,6 +109,12 @@ public function getName(): string
108109

109110
private static function escape(Environment $env, string $s): string
110111
{
112+
// Twig 3.10 and above
113+
if (class_exists(EscaperRuntime::class)) {
114+
return $env->getRuntime(EscaperRuntime::class)->escape($s);
115+
}
116+
117+
// Twig 3.9
111118
if (method_exists(EscaperExtension::class, 'escape')) {
112119
return EscaperExtension::escape($env, $s);
113120
}

src/Symfony/Component/Cache/Traits/RedisTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ protected function doClear(string $namespace): bool
517517
}
518518
$this->doDelete($keys);
519519
}
520-
} while ($cursor = (int) $cursor);
520+
} while ($cursor);
521521
}
522522

523523
return $cleared;

src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ public function testImportWithFileLocatorDelegation()
2525
$locatorMock = $this->createMock(FileLocatorInterface::class);
2626

2727
$locatorMockForAdditionalLoader = $this->createMock(FileLocatorInterface::class);
28-
$locatorMockForAdditionalLoader->expects($this->any())->method('locate')->will($this->onConsecutiveCalls(
29-
['path/to/file1'], // Default
30-
['path/to/file1', 'path/to/file2'], // First is imported
31-
['path/to/file1', 'path/to/file2'], // Second is imported
32-
['path/to/file1'], // Exception
33-
['path/to/file1', 'path/to/file2'] // Exception
34-
));
28+
$locatorMockForAdditionalLoader->expects($this->any())
29+
->method('locate')
30+
->willReturn(
31+
['path/to/file1'],
32+
['path/to/file1', 'path/to/file2'],
33+
['path/to/file1', 'path/to/file2'],
34+
['path/to/file1'],
35+
['path/to/file1', 'path/to/file2']
36+
);
3537

3638
$fileLoader = new TestFileLoader($locatorMock);
3739
$fileLoader->setSupports(false);

src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ public function testLoadFile()
7676
}
7777

7878
$mock = $this->createMock(Validator::class);
79-
$mock->expects($this->exactly(2))->method('validate')->will($this->onConsecutiveCalls(false, true));
79+
$mock->expects($this->exactly(2))->method('validate')
80+
->willReturn(false, true);
8081

8182
try {
8283
XmlUtils::loadFile($fixtures.'valid.xml', [$mock, 'validate']);

0 commit comments

Comments
 (0)