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 84061f1

Browse filesBrowse 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
Copy full SHA for 84061f1

File tree

Expand file treeCollapse file tree

42 files changed

+410
-214
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

42 files changed

+410
-214
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineOpenTransactionLoggerMiddlewareTest.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php
+1-4Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+7-6Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.php
+2-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Tests/Twig/WebProfilerExtensionTest.php
+2-10Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php
+7Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/RedisTrait.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php
+9-7Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php
+2-1Lines 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']);

‎src/Symfony/Component/Filesystem/Path.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Filesystem/Path.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ public static function isAbsolute(string $path): bool
365365
}
366366

367367
// Strip scheme
368-
if (false !== $schemeSeparatorPosition = strpos($path, '://')) {
368+
if (false !== ($schemeSeparatorPosition = strpos($path, '://')) && 1 !== $schemeSeparatorPosition) {
369369
$path = substr($path, $schemeSeparatorPosition + 3);
370370
}
371371

‎src/Symfony/Component/Filesystem/Tests/PathTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Filesystem/Tests/PathTest.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ public static function provideIsAbsolutePathTests(): \Generator
375375

376376
yield ['C:/css/style.css', true];
377377
yield ['D:/', true];
378+
yield ['C:///windows', true];
379+
yield ['C://test', true];
378380

379381
yield ['E:\\css\\style.css', true];
380382
yield ['F:\\', true];

‎src/Symfony/Component/Filesystem/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Filesystem/composer.json
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"require": {
1919
"php": ">=8.1",
2020
"symfony/polyfill-ctype": "~1.8",
21-
"symfony/polyfill-mbstring": "~1.8",
21+
"symfony/polyfill-mbstring": "~1.8"
22+
},
23+
"require-dev": {
2224
"symfony/process": "^5.4|^6.4"
2325
},
2426
"autoload": {

‎src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class SessionListenerTest extends TestCase
4444
public function testSessionCookieOptions(array $phpSessionOptions, array $sessionOptions, array $expectedSessionOptions)
4545
{
4646
$session = $this->createMock(Session::class);
47-
$session->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1));
47+
$session->method('getUsageIndex')->willReturn(0, 1);
4848
$session->method('getId')->willReturn('123456');
4949
$session->method('getName')->willReturn('PHPSESSID');
5050
$session->method('save');
@@ -493,7 +493,7 @@ public function testResponseIsStillPublicIfSessionStartedAndHeaderPresent()
493493
public function testSessionSaveAndResponseHasSessionCookie()
494494
{
495495
$session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock();
496-
$session->expects($this->exactly(1))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1));
496+
$session->expects($this->exactly(1))->method('getUsageIndex')->willReturn(0);
497497
$session->expects($this->exactly(1))->method('getId')->willReturn('123456');
498498
$session->expects($this->exactly(1))->method('getName')->willReturn('PHPSESSID');
499499
$session->expects($this->exactly(1))->method('save');
@@ -646,7 +646,7 @@ public function testSurrogateMainRequestIsPublic()
646646
{
647647
$session = $this->createMock(Session::class);
648648
$session->expects($this->exactly(1))->method('getName')->willReturn('PHPSESSID');
649-
$session->expects($this->exactly(2))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1));
649+
$session->expects($this->exactly(2))->method('getUsageIndex')->willReturn(0, 1);
650650
$sessionFactory = $this->createMock(SessionFactory::class);
651651
$sessionFactory->expects($this->once())->method('createSession')->willReturn($session);
652652

‎src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php
+11-4Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,17 @@ public function testRenderExceptionIgnoreErrors()
102102

103103
public function testRenderExceptionIgnoreErrorsWithAlt()
104104
{
105-
$strategy = new InlineFragmentRenderer($this->getKernel($this->onConsecutiveCalls(
106-
$this->throwException(new \RuntimeException('foo')),
107-
$this->returnValue(new Response('bar'))
108-
)));
105+
$strategy = new InlineFragmentRenderer($this->getKernel($this->returnCallback(function () {
106+
static $firstCall = true;
107+
108+
if ($firstCall) {
109+
$firstCall = false;
110+
111+
throw new \RuntimeException('foo');
112+
}
113+
114+
return new Response('bar');
115+
})));
109116

110117
$this->assertEquals('bar', $strategy->render('/', Request::create('/'), ['ignore_errors' => true, 'alt' => '/foo'])->getContent());
111118
}

‎src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ protected function getCache($request, $response)
245245
if (\is_array($response)) {
246246
$cache->expects($this->any())
247247
->method('handle')
248-
->will($this->onConsecutiveCalls(...$response))
248+
->willReturn(...$response)
249249
;
250250
} else {
251251
$cache->expects($this->any())

‎src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ protected function getCache($request, $response)
201201
if (\is_array($response)) {
202202
$cache->expects($this->any())
203203
->method('handle')
204-
->will($this->onConsecutiveCalls(...$response))
204+
->willReturn(...$response)
205205
;
206206
} else {
207207
$cache->expects($this->any())

0 commit comments

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