10000 Merge branch '6.4' into 7.0 · symfony/symfony@8447814 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8447814

Browse files
Merge branch '6.4' into 7.0
* 6.4: [Cache] Fix test failure related to Redis6Proxy on appveyor [Messenger] Fix reading pending messages with Redis [Serializer] Revert #54488 to fix BC Break [Validator] reviewed Polish translation for unit 113 [Validator] Missing translations for Croatian (hr) Add hint which version of Symfony not longer require proxy manager bridge review and fix hungarian validation message Update translation review uk translations v2 [Validator] Update message translations for unit 113 (TLD) [Intl] Remove resources data from classmap generation
2 parents 8fdef5a + bb1664e commit 8447814

File tree

72 files changed

+156
-492
lines changed

Some content is hidden

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

72 files changed

+156
-492
lines changed

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

< 10000 span aria-hidden="true" class="f6 text-bold fgColor-success">+11Lines changed: 11 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
class RedisProxiesTest extends TestCase
2020
{
2121
/**
22-
* @requires extension redis < 6
22+
* @requires extension redis
2323
*
2424
* @testWith ["Redis"]
2525
* ["RedisCluster"]
2626
*/
27-
public function testRedis5Proxy($class)
27+
public function testRedisProxy($class)
2828
{
29-
$proxy = file_get_contents(\dirname(__DIR__, 2)."/Traits/{$class}5Proxy.php");
30-
$proxy = substr($proxy, 0, 4 + strpos($proxy, '[];'));
29+
$version = version_compare(phpversion('redis'), '6', '>') ? '6' : '5';
30+
$proxy = file_get_contents(\dirname(__DIR__, 2)."/Traits/{$class}{$version}Proxy.php");
31+
$expected = substr($proxy, 0, 4 + strpos($proxy, '[];'));
3132
$methods = [];
3233

3334
foreach ((new \ReflectionClass($class))->getMethods() as $method) {
@@ -44,9 +45,13 @@ public function testRedis5Proxy($class)
4445
}
4546

4647
uksort($methods, 'strnatcmp');
47-
$proxy .= implode('', $methods)."}\n";
48+
$expected .= implode('', $methods)."}\n";
49+
50+
if (!str_contains($expected, '#[\SensitiveParameter] ')) {
51+
$proxy = str_replace('#[\SensitiveParameter] ', '', $proxy);
52+
}
4853

49-
$this->assertStringEqualsFile(\dirname(__DIR__, 2)."/Traits/{$class}5Proxy.php", $proxy);
54+
$this->assertSame($expected, $proxy);
5055
}
5156

5257
/**
@@ -76,50 +81,4 @@ public function testRelayProxy()
7681

7782
$this->assertStringEqualsFile(\dirname(__DIR__, 2).'/Traits/RelayProxy.php', $proxy);
7883
}
79-
80-
/**
81-
* @requires extension openssl
82-
*
83-
* @testWith ["Redis", "redis"]
84-
* ["RedisCluster", "redis_cluster"]
85-
*/
86-
public function testRedis6Proxy($class, $stub)
87-
{
88-
if (version_compare(phpversion('redis'), '6.0.2', '>')) {
89-
$stub = file_get_contents("https://raw.githubusercontent.com/phpredis/phpredis/develop/{$stub}.stub.php");
90-
} else {
91-
$stub = file_get_contents("https://raw.githubusercontent.com/phpredis/phpredis/6.0.2/{$stub}.stub.php");
92-
}
93-
94-
$stub = preg_replace('/^class /m', 'return; \0', $stub);
95-
$stub = preg_replace('/^return; class ([a-zA-Z]++)/m', 'interface \1StubInterface', $stub, 1);
96-
$stub = preg_replace('/^ public const .*/m', '', $stub);
97-
eval(substr($stub, 5));
98-
99-
$this->assertEquals(self::dumpMethods(new \ReflectionClass($class.'StubInterface')), self::dumpMethods(new \ReflectionClass(sprintf('Symfony\Component\Cache\Traits\%s6Proxy', $class))));
100-
}
101-
102-
private static function dumpMethods(\ReflectionClass $class): string
103-
{
104-
$methods = [];
105-
106-
foreach ($class->getMethods() as $method) {
107-
if ('reset' === $method->name || method_exists(LazyProxyTrait::class, $method->name)) {
108-
continue;
109-
}
110-
111-
$return = $method->getReturnType() instanceof \ReflectionNamedType && 'void' === (string) $method->getReturnType() ? '' : 'return ';
112-
$signature = ProxyHelper::exportSignature($method, false, $args);
113-
$methods[] = "\n ".str_replace('timeout = 0.0', 'timeout = 0', $signature)."\n".<<<EOPHP
114-
{
115-
{$return}(\$this->lazyObjectState->realInstance ??= (\$this->lazyObjectState->initializer)())->{$method->name}({$args});
116-
}
117-
118-
EOPHP;
119-
}
120-
121-
usort($methods, 'strnatcmp');
122-
123-
return implode("\n", $methods);
124-
}
12584
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function append($key, $value)
8181
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->append(...\func_get_args());
8282
}
8383

84-
public function auth($auth)
84+
public function auth(#[\SensitiveParameter] $auth)
8585
{
8686
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->auth(...\func_get_args());
8787
}

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class Redis6Proxy extends \Redis implements ResetInterface, LazyObjectInterface
2828
use LazyProxyTrait {
2929
resetLazyObject as reset;
3030
}
31-
use Redis6ProxyTrait;
3231

3332
private const LAZY_OBJECT_PROPERTY_SCOPES = [];
3433

@@ -227,6 +226,11 @@ public function discard(): \Redis|bool
227226
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->discard(...\func_get_args());
228227
}
229228

229+
public function dump($key): \Redis|string
230+
{
231+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args());
232+
}
233+
230234
public function echo($str): \Redis|false|string
231235
{
232236
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->echo(...\func_get_args());
@@ -647,6 +651,11 @@ public function ltrim($key, $start, $end): \Redis|bool
647651
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ltrim(...\func_get_args());
648652
}
649653

654+
public function mget($keys): \Redis|array
655+
{
656+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mget(...\func_get_args());
657+
}
658+
650659
public function migrate($host, $port, $key, $dstdb, $timeout, $copy = false, $replace = false, #[\SensitiveParameter] $credentials = null): \Redis|bool
651660
{
652661
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->migrate(...\func_get_args());

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

Lines changed: 0 additions & 51 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class RedisCluster5Proxy extends \RedisCluster implements ResetInterface, LazyOb
3131

3232
private const LAZY_OBJECT_PROPERTY_SCOPES = [];
3333

34-
public function __construct($name, $seeds = null, $timeout = null, $read_timeout = null, $persistent = null, $auth = null)
34+
public function __construct($name, $seeds = null, $timeout = null, $read_timeout = null, $persistent = null, #[\SensitiveParameter] $auth = null)
3535
{
3636
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->__construct(...\func_get_args());
3737
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class RedisCluster6Proxy extends \RedisCluster implements ResetInterface, LazyOb
2828
use LazyProxyTrait {
2929
resetLazyObject as reset;
3030
}
31-
use RedisCluster6ProxyTrait;
3231

3332
private const LAZY_OBJECT_PROPERTY_SCOPES = [];
3433

@@ -657,6 +656,11 @@ public function pttl($key): \RedisCluster|false|int
657656
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pttl(...\func_get_args());
658657
}
659658

659+
public function publish($channel, $message): \RedisCluster|bool
660+
{
661+
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->publish(...\func_get_args());
662+
}
663+
660664
public function pubsub($key_or_address, ...$values): mixed
661665
{
662666
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pubsub(...\func_get_args());

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

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/Symfony/Component/Intl/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"autoload": {
3535
"psr-4": { "Symfony\\Component\\Intl\\": "" },
3636
"exclude-from-classmap": [
37-
"/Tests/"
37+
"/Tests/",
38+
"/Resources/data/"
3839
]
3940
},
4041
"minimum-stability": "dev"

src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ private function claimOldPendingMessages(): void
330330
try {
331331
// This could soon be optimized with https://github.com/antirez/redis/issues/5212 or
332332
// https://github.com/antirez/redis/issues/6256
333-
$pendingMessages = $this->getRedis()->xpending($this->stream, $this->group, '-', '+', 1);
333+
$pendingMessages = $this->getRedis()->xpending($this->stream, $this->group, '-', '+', 1) ?: [];
334334
} catch (\RedisException|\Relay\Exception $e) {
335335
throw new TransportException($e->getMessage(), 0, $e);
336336
}

src/Symfony/Component/Serializer/Mapping/Loader/AttributeLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool
125125

126126
$accessorOrMutator = preg_match('/^(get|is|has|set)(.+)$/i', $method->name, $matches);
127127
if ($accessorOrMutator) {
128-
$attributeName = $reflectionClass->hasProperty($method->name) ? $method->name : lcfirst($matches[2]);
128+
$attributeName = lcfirst($matches[2]);
129129

130130
if (isset($attributesMetadata[$attributeName])) {
131131
$attributeMetadata = $attributesMetadata[$attributeName];

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,25 +86,17 @@ protected function extractAttributes(object $object, ?string $format = null, arr
8686

8787
if (str_starts_with($name, 'get') || str_starts_with($name, 'has') || str_starts_with($name, 'can')) {
8888
// getters, hassers and canners
89-
$attributeName = $name;
89+
$attributeName = substr($name, 3);
9090

9191
if (!$reflClass->hasProperty($attributeName)) {
92-
$attributeName = substr($attributeName, 3);
93-
94-
if (!$reflClass->hasProperty($attributeName)) {
95-
$attributeName = lcfirst($attributeName);
96-
}
92+
$attributeName = lcfirst($attributeName);
9793
}
9894
} elseif (str_starts_with($name, 'is')) {
9995
// issers
100-
$attributeName = $name;
96+
$attributeName = substr($name, 2);
10197

10298
if (!$reflClass->hasProperty($attributeName)) {
103-
$attributeName = substr($attributeName, 2);
104-
105-
if (!$reflClass->hasProperty($attributeName)) {
106-
$attributeName = lcfirst($attributeName);
107-
}
99+
$attributeName = lcfirst($attributeName);
108100
}
109101
}
110102

src/Symfony/Component/Serializer/Tests/Fixtures/SamePropertyAsMethodDummy.php

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0