Skip to content

Commit 2bacd10

Browse files
committed
Merge branch '6.4' into 7.1
* 6.4: (23 commits) fix tests using Twig 3.12 skip tests requiring the intl extension if it's not installed 🐛 throw ParseException on invalid date fix permitted data type of the default choice [ExpressionLanguage] Improve test coverage Fix invalid phpdoc in ContainerBuilder [HttpKernel] [WebProfileBundle] Fix Routing panel for URLs with a colon [Form] NumberType: Fix parsing of numbers in exponential notation with negative exponent [Security] consistent singular/plural translation in Dutch reset the validation context after validating nested constraints do not duplicate directory separators fix handling empty data in ValueToDuplicatesTransformer fix compatibility with redis extension 6.0.3+ synchronize unsupported scheme tests [String] Fixed Quorum plural, that was inflected to be only "Quora" and never "Quorums" Fix symfony/kaz-info-teh-notifier package [Validator] review latvian translations [Validator] Add Dutch translation for `WordCount` constraint allow more unicode characters in URL paths [String][EnglishInflector] Fix words ending in 'le', e.g., articles ...
2 parents 94e474a + f18d5bb commit 2bacd10

File tree

38 files changed

+485
-59
lines changed

38 files changed

+485
-59
lines changed

src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function testGenerateFragmentUri()
7070
'index' => sprintf(<<<TWIG
7171
{{ fragment_uri(controller("%s::templateAction", {template: "foo.html.twig"})) }}
7272
TWIG
73-
, TemplateController::class), ]);
73+
, str_replace('\\', '\\\\', TemplateController::class)), ]);
7474
$twig = new Environment($loader, ['debug' => true, 'cache' => false]);
7575
$twig->addExtension(new HttpKernelExtension());
7676

@@ -80,7 +80,7 @@ public function testGenerateFragmentUri()
8080
]);
8181
$twig->addRuntimeLoader($loader);
8282

83-
$this->assertSame('/_fragment?_hash=PP8%2FeEbn1pr27I9wmag%2FM6jYGVwUZ0l2h0vhh2OJ6CI%3D&amp;_path=template%3Dfoo.html.twig%26_format%3Dhtml%26_locale%3Den%26_controller%3DSymfonyBundleFrameworkBundleControllerTemplateController%253A%253AtemplateAction', $twig->render('index'));
83+
$this->assertSame('/_fragment?_hash=XCg0hX8QzSwik8Xuu9aMXhoCeI4oJOob7lUVacyOtyY%3D&amp;_path=template%3Dfoo.html.twig%26_format%3Dhtml%26_locale%3Den%26_controller%3DSymfony%255CBundle%255CFrameworkBundle%255CController%255CTemplateController%253A%253AtemplateAction', $twig->render('index'));
8484
}
8585

8686
protected function getFragmentHandler($returnOrException): FragmentHandler

src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ public function panelAction(string $token): Response
7979
*/
8080
private function getTraces(RequestDataCollector $request, string $method): array
8181
{
82-
$traceRequest = Request::create(
83-
$request->getPathInfo(),
84-
$request->getRequestServer(true)->get('REQUEST_METHOD'),
85-
\in_array($request->getMethod(), ['DELETE', 'PATCH', 'POST', 'PUT'], true) ? $request->getRequestRequest()->all() : $request->getRequestQuery()->all(),
82+
$traceRequest = new Request(
83+
$request->getRequestQuery()->all(),
84+
$request->getRequestRequest()->all(),
85+
$request->getRequestAttributes()->all(),
8686
$request->getRequestCookies(true)->all(),
8787
[],
8888
$request->getRequestServer(true)->all()
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\WebProfilerBundle\Tests\Controller;
13+
14+
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
15+
use Symfony\Bundle\FrameworkBundle\Routing\Router;
16+
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
17+
use Symfony\Bundle\WebProfilerBundle\Tests\Functional\WebProfilerBundleKernel;
18+
use Symfony\Component\DomCrawler\Crawler;
19+
use Symfony\Component\Routing\Route;
20+
21+
class RouterControllerTest extends WebTestCase
22+
{
23+
public function testFalseNegativeTrace()
24+
{
25+
$path = '/foo/bar:123/baz';
26+
27+
$kernel = new WebProfilerBundleKernel();
28+
$client = new KernelBrowser($kernel);
29+
$client->disableReboot();
30+
$client->getKernel()->boot();
31+
32+
/** @var Router $router */
33+
$router = $client->getContainer()->get('router');
34+
$router->getRouteCollection()->add('route1', new Route($path));
35+
36+
$client->request('GET', $path);
37+
38+
$crawler = $client->request('GET', '/_profiler/latest?panel=router&type=request');
39+
40+
$matchedRouteCell = $crawler
41+
->filter('#router-logs .status-success td')
42+
->reduce(function (Crawler $td) use ($path): bool {
43+
return $td->text() === $path;
44+
});
45+
46+
$this->assertSame(1, $matchedRouteCell->count());
47+
}
48+
}

src/Symfony/Component/Cache/Tests/Traits/RedisProxiesTest.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,34 @@ public function testRedisProxy($class)
2929
{
3030
$version = version_compare(phpversion('redis'), '6', '>') ? '6' : '5';
3131
$proxy = file_get_contents(\dirname(__DIR__, 2)."/Traits/{$class}{$version}Proxy.php");
32+
$proxy = substr($proxy, 0, 4 + strpos($proxy, '[];'));
3233
$expected = substr($proxy, 0, 4 + strpos($proxy, '[];'));
3334
$methods = [];
3435

36+
foreach ((new \ReflectionClass(sprintf('Symfony\Component\Cache\Traits\\%s%dProxy', $class, $version)))->getMethods() as $method) {
37+
if ('reset' === $method->name || method_exists(LazyProxyTrait::class, $method->name)) {
38+
continue;
39+
}
40+
$return = $method->getReturnType() instanceof \ReflectionNamedType && 'void' === (string) $method->getReturnType() ? '' : 'return ';
41+
$methods[$method->name] = "\n ".ProxyHelper::exportSignature($method, false, $args)."\n".<<<EOPHP
42+
{
43+
{$return}(\$this->lazyObjectState->realInstance ??= (\$this->lazyObjectState->initializer)())->{$method->name}({$args});
44+
}
45+
46+
EOPHP;
47+
}
48+
49+
uksort($methods, 'strnatcmp');
50+
$proxy .= implode('', $methods)."}\n";
51+
52+
$methods = [];
53+
3554
foreach ((new \ReflectionClass($class))->getMethods() as $method) {
3655
if ('reset' === $method->name || method_exists(LazyProxyTrait::class, $method->name)) {
3756
continue;
3857
}
3958
$return = $method->getReturnType() instanceof \ReflectionNamedType && 'void' === (string) $method->getReturnType() ? '' : 'return ';
40-
$methods[] = "\n ".ProxyHelper::exportSignature($method, false, $args)."\n".<<<EOPHP
59+
$methods[$method->name] = "\n ".ProxyHelper::exportSignature($method, false, $args)."\n".<<<EOPHP
4160
{
4261
{$return}(\$this->lazyObjectState->realInstance ??= (\$this->lazyObjectState->initializer)())->{$method->name}({$args});
4362
}

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

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class_exists(\Symfony\Component\VarExporter\Internal\LazyObjectState::class);
2525
*/
2626
class Redis6Proxy extends \Redis implements ResetInterface, LazyObjectInterface
2727
{
28+
use Redis6ProxyTrait;
2829
use LazyProxyTrait {
2930
resetLazyObject as reset;
3031
}
@@ -226,11 +227,6 @@ public function discard(): \Redis|bool
226227
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->discard(...\func_get_args());
227228
}
228229

229-
public function dump($key): \Redis|string
230-
{
231-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args());
232-
}
233-
234230
public function echo($str): \Redis|false|string
235231
{
236232
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->echo(...\func_get_args());
@@ -511,16 +507,6 @@ public function hMset($key, $fieldvals): \Redis|bool
511507
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hMset(...\func_get_args());
512508
}
513509

514-
public function hRandField($key, $options = null): \Redis|array|string
515-
{
516-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hRandField(...\func_get_args());
517-
}
518-
519-
public function hSet($key, $member, $value): \Redis|false|int
520-
{
521-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hSet(...\func_get_args());
522-
}
523-
524510
public function hSetNx($key, $field, $value): \Redis|bool
525511
{
526512
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hSetNx(...\func_get_args());
@@ -651,11 +637,6 @@ public function ltrim($key, $start, $end): \Redis|bool
651637
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ltrim(...\func_get_args());
652638
}
653639

654-
public function mget($keys): \Redis|array
655-
{
656-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mget(...\func_get_args());
657-
}
658-
659640
public function migrate($host, $port, $key, $dstdb, $timeout, $copy = false, $replace = false, #[\SensitiveParameter] $credentials = null): \Redis|bool
660641
{
661642
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->migrate(...\func_get_args());
@@ -866,11 +847,6 @@ public function sPop($key, $count = 0): \Redis|array|false|string
866847
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sPop(...\func_get_args());
867848
}
868849

869-
public function sRandMember($key, $count = 0): \Redis|array|false|string
870-
{
871-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sRandMember(...\func_get_args());
872-
}
873-
874850
public function sUnion($key, ...$other_keys): \Redis|array|false
875851
{
876852
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sUnion(...\func_get_args());
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Cache\Traits;
13+
14+
if (version_compare(phpversion('redis'), '6.1.0', '>=')) {
15+
/**
16+
* @internal
17+
*/
18+
trait Redis6ProxyTrait
19+
{
20+
public function dump($key): \Redis|string|false
21+
{
22+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args());
23+
}
24+
25+
public function hRandField($key, $options = null): \Redis|array|string|false
26+
{
27+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hRandField(...\func_get_args());
28+
}
29+
30+
public function hSet($key, $fields_and_vals): \Redis|false|int
31+
{
32+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hSet(...\func_get_args());
33+
}
34+
35+
public function mget($keys): \Redis|array|false
36+
{
37+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mget(...\func_get_args());
38+
}
39+
40+
public function sRandMember($key, $count = 0): mixed
41+
{
42+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sRandMember(...\func_get_args());
43+
}
44+
45+
public function waitaof($numlocal, $numreplicas, $timeout): \Redis|array|false
46+
{
47+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->waitaof(...\func_get_args());
48+
}
49+
}
50+
} else {
51+
/**
52+
* @internal
53+
*/
54+
trait Redis6ProxyTrait
55+
{
56+
public function dump($key): \Redis|string
57+
{
58+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args());
59+
}
60+
61+
public function hRandField($key, $options = null): \Redis|array|string
62+
{
63+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hRandField(...\func_get_args());
64+
}
65+
66+
public function hSet($key, $member, $value): \Redis|false|int
67+
{
68+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hSet(...\func_get_args());
69+
}
70+
71+
public function mget($keys): \Redis|array
72+
{
73+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mget(...\func_get_args());
74+
}
75+
76+
public function sRandMember($key, $count = 0): \Redis|array|false|string
77+
{
78+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sRandMember(...\func_get_args());
79+
}
80+
}
81+
}

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class_exists(\Symfony\Component\VarExporter\Internal\LazyObjectState::class);
2525
*/
2626
class RedisCluster6Proxy extends \RedisCluster implements ResetInterface, LazyObjectInterface
2727
{
28+
use RedisCluster6ProxyTrait;
2829
use LazyProxyTrait {
2930
resetLazyObject as reset;
3031
}
@@ -656,11 +657,6 @@ public function pttl($key): \RedisCluster|false|int
656657
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pttl(...\func_get_args());
657658
}
658659

659-
public function publish($channel, $message): \RedisCluster|bool
660-
{
661-
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->publish(...\func_get_args());
662-
}
663-
664660
public function pubsub($key_or_address, ...$values): mixed
665661
{
666662
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pubsub(...\func_get_args());
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Cache\Traits;
13+
14+
if (version_compare(phpversion('redis'), '6.1.0', '>')) {
15+
/**
16+
* @internal
17+
*/
18+
trait RedisCluster6ProxyTrait
19+
{
20+
public function getex($key, $options = []): \RedisCluster|string|false
21+
{
22+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getex(...\func_get_args());
23+
}
24+
25+
public function publish($channel, $message): \RedisCluster|bool|int
26+
{
27+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->publish(...\func_get_args());
28+
}
29+
30+
public function waitaof($key_or_address, $numlocal, $numreplicas, $timeout): \RedisCluster|array|false
31+
{
32+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->waitaof(...\func_get_args());
33+
}
34+
}
35+
} else {
36+
/**
37+
* @internal
38+
*/
39+
trait RedisCluster6ProxyTrait
40+
{
41+
public function publish($channel, $message): \RedisCluster|bool
42+
{
43+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->publish(...\func_get_args());
44+
}
45+
}
46+
}

src/Symfony/Component/Console/Question/ChoiceQuestion.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ class ChoiceQuestion extends Question
2525
private string $errorMessage = 'Value "%s" is invalid';
2626

2727
/**
28-
* @param string $question The question to ask to the user
29-
* @param array $choices The list of available choices
30-
* @param mixed $default The default answer to return
28+
* @param string $question The question to ask to the user
29+
* @param array $choices The list of available choices
30+
* @param string|bool|int|float|null $default The default answer to return
3131
*/
3232
public function __construct(
3333
string $question,
3434
private array $choices,
35-
mixed $default = null,
35+
string|bool|int|float|null $default = null,
3636
) {
3737
if (!$choices) {
3838
throw new \LogicException('Choice question must have at least 1 choice available.');

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
117117
private array $vendors;
118118

119119
/**
120-
* @var string[] the list of paths in vendor directories
120+
* @var array<string, bool> the cache for paths being in vendor directories
121121
*/
122122
private array $pathsInVendor = [];
123123

0 commit comments

Comments
 (0)