8000 Merge branch '7.2' into 7.3 · symfony/symfony@ca6f399 · GitHub
[go: up one dir, main page]

Skip to content

Commit ca6f399

Browse files
Merge branch '7.2' into 7.3
* 7.2: [psalm] ensureOverrideAttribute="false" [Semaphore] allow redis cluster/sentinel dsn [MIME] use address for body at PathHeader
2 parents 1e74e69 + 4e4fd9d commit ca6f399

File tree

5 files changed

+28
-36
lines changed

5 files changed

+28
-36
lines changed

psalm.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
findUnusedBaselineEntry="false"
1111
findUnusedCode="false"
1212
findUnusedIssueHandlerSuppression="false"
13+
ensureOverrideAttribute="false"
1314
>
1415
<projectFiles>
1516
<directory name="src" />

src/Symfony/Component/Mime/Header/PathHeader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ public function getAddress(): Address
5757

5858
public function getBodyAsString(): string
5959
{
60-
return '<'.$this->address->toString().'>';
60+
return '<'.$this->address->getEncodedAddress().'>';
6161
}
6262
}

src/Symfony/Component/Mime/Tests/Header/HeadersTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,4 +346,12 @@ public function testSetHeaderParameterNotParameterized()
346346
$this->expectException(\LogicException::class);
347347
$headers->setHeaderParameter('Content-Disposition', 'name', 'foo');
348348
}
349+
350+
public function testPathHeaderHasNoName()
351+
{
352+
$headers = new Headers();
353+
354+
$headers->addPathHeader('Return-Path', new Address('some@path', 'any ignored name'));
355+
$this->assertSame('<some@path>', $headers->get('Return-Path')->getBodyAsString());
356+
}
349357
}

src/Symfony/Component/Semaphore/Store/StoreFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public static function createStore(#[\SensitiveParameter] object|string $connect
3535

3636
case !\is_string($connection):
3737
throw new InvalidArgumentException(\sprintf('Unsupported Connection: "%s".', $connection::class));
38-
case str_starts_with($connection, 'redis://'):
39-
case str_starts_with($connection, 'rediss://'):
38+
case str_starts_with($connection, 'redis:'):
39+
case str_starts_with($connection, 'rediss:'):
4040
if (!class_exists(AbstractAdapter::class)) {
4141
throw new InvalidArgumentException('Unsupported Redis DSN. Try running "composer require symfony/cache".');
4242
}

src/Symfony/Component/Semaphore/Tests/Store/StoreFactoryTest.php

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,54 +12,37 @@
1212
namespace Symfony\Component\Semaphore\Tests\Store;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\Cache\Traits\RedisProxy;
1615
use Symfony\Component\Semaphore\Store\RedisStore;
1716
use Symfony\Component\Semaphore\Store\StoreFactory;
1817

1918
/**
2019
* @author Jérémy Derussé <jeremy@derusse.com>
21-
*
22-
* @requires extension redis
2320
*/
2421
class StoreFactoryTest extends TestCase
2522
{
26-
public function testCreateRedisStore()
23+
/**
24+
* @dataProvider validConnections
25+
*/
26+
public function testCreateStore($connection, string $expectedStoreClass)
2727
{
28-
$store = StoreFactory::createStore($this->createMock(\Redis::class));
28+
$store = StoreFactory::createStore($connection);
2929

30-
$this->assertInstanceOf(RedisStore::class, $store);
30+
$this->assertInstanceOf($expectedStoreClass, $store);
3131
}
3232

33-
public function testCreateRedisProxyStore()
33+
public static function validConnections(): \Generator
3434
{
35-
if (!class_exists(RedisProxy::class)) {
36-
$this->markTestSkipped();
37-
}
35+
yield [new \Predis\Client(), RedisStore::class];
3836

39-
$store = StoreFactory::createStore($this->createMock(RedisProxy::class));
40-
41-
$this->assertInstanceOf(RedisStore::class, $store);
42-
}
43-
44-
public function testCreateRedisAsDsnStore()
45-
{
46-
if (!class_exists(RedisProxy::class)) {
47-
$this->markTestSkipped();
37+
if (class_exists(\Redis::class)) {
38+
yield [new \Redis(), RedisStore::class];
4839
}
49-
50-
$store = StoreFactory::createStore('redis://localhost');
51-
52-
$this->assertInstanceOf(RedisStore::class, $store);
53-
}
54-
55-
public function testCreatePredisStore()
56-
{
57-
if (!class_exists(\Predis\Client::class)) {
58-
$this->markTestSkipped();
40+
if (class_exists(\Redis::class) && class_exists(AbstractAdapter::class)) {
41+
yield ['redis://localhost', RedisStore::class];
42+
yield ['redis://localhost?lazy=1', RedisStore::class];
43+
yield ['redis://localhost?redis_cluster=1', RedisStore::class];
44+
yield ['redis://localhost?redis_cluster=1&lazy=1', RedisStore::class];
45+
yield ['redis:?host[localhost]&host[localhost:6379]&redis_cluster=1', RedisStore::class];
5946
}
60-
61-
$store = StoreFactory::createStore(new \Predis\Client());
62-
63-
$this->assertInstanceOf(RedisStore::class, $store);
6447
}
6548
}

0 commit comments

Comments
 (0)
0