Skip to content

Commit 84061f1

Browse files
committed
Merge branch '5.4' into 6.4
* 5.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 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 convert empty CSV header names into numeric keys
2 parents 0c764e7 + 04ee49a commit 84061f1

File tree

42 files changed

+410
-214
lines changed

Some content is hidden

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

42 files changed

+410
-214
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
@@ -110,10 +110,7 @@ public function testVerbosityChanged()
110110
$output
111111
->expects($this->exactly(2))
112112
->method('getVerbosity')
113-
->willReturnOnConsecutiveCalls(
114-
OutputInterface::VERBOSITY_QUIET,
115-
OutputInterface::VERBOSITY_DEBUG
116-
)
113+
->willReturn(OutputInterface::VERBOSITY_QUIET, OutputInterface::VERBOSITY_DEBUG)
117114
;
118115
$handler = new ConsoleHandler($output);
119116
$this->assertFalse($handler->isHandling(RecordFactory::create(Logger::NOTICE)),

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

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

1999+
$arguments = $container->getDefinition('serializer.normalizer.object')->getArguments();
2000+
$context = [];
2001+
19992002
if (isset($config['circular_reference_handler']) && $config['circular_reference_handler']) {
2000-
$arguments = $container->getDefinition('serializer.normalizer.object')->getArguments();
2001-
$context = ($arguments[6] ?? $defaultContext) + ['circular_reference_handler' => new Reference($config['circular_reference_handler'])];
2003+
$context += ($arguments[6] ?? $defaultContext) + ['circular_reference_handler' => new Reference($config['circular_reference_handler'])];
20022004
$container->getDefinition('serializer.normalizer.object')->setArgument(5, null);
2003-
$container->getDefinition('serializer.normalizer.object')->setArgument(6, $context);
20042005
}
20052006

20062007
if ($config['max_depth_handler'] ?? false) {
2007-
$arguments = $container->getDefinition('serializer.normalizer.object')->getArguments();
2008-
$context = ($arguments[6] ?? $defaultContext) + ['max_depth_handler' => new Reference($config['max_depth_handler'])];
2009-
$container->getDefinition('serializer.normalizer.object')->setArgument(6, $context);
2008+
$context += ($arguments[6] ?? $defaultContext) + ['max_depth_handler' => new Reference($config['max_depth_handler'])];
20102009
}
2010+
2011+
$container->getDefinition('serializer.normalizer.object')->setArgument(6, $context);
20112012
}
20122013

20132014
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
@@ -129,6 +129,8 @@
129129
service('property_info')->ignoreOnInvalid(),
130130
service('serializer.mapping.class_discriminator_resolver')->ignoreOnInvalid(),
131131
null,
132+
null,
133+
service('property_info')->ignoreOnInvalid(),
132134
])
133135
->tag('serializer.normalizer', ['priority' => -1000])
134136

@@ -143,7 +145,6 @@
143145
service('serializer.mapping.class_discriminator_resolver')->ignoreOnInvalid(),
144146
null,
145147
[],
146-
service('property_info')->ignoreOnInvalid(),
147148
])
148149

149150
->alias(PropertyNormalizer::class, 'serializer.normalizer.property')

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)