Skip to content

Commit 29f12c5

Browse files
Merge branch '5.2' into 5.3
* 5.2: [Contracts] Add missing `@return` annotations [FrameworkBundle] Fixed file operations in Sodium vault seal [Messenger] [Redis] Make `auth` option works
2 parents cdc5aec + 8c75b86 commit 29f12c5

File tree

9 files changed

+50
-4
lines changed

9 files changed

+50
-4
lines changed

src/Symfony/Bundle/FrameworkBundle/Secrets/SodiumVault.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function seal(string $name, string $value): void
9090
$list = $this->list();
9191
$list[$name] = null;
9292
uksort($list, 'strnatcmp');
93-
file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", VarExporter::export($list), \LOCK_EX));
93+
file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", VarExporter::export($list)), \LOCK_EX);
9494

9595
$this->lastMessage = sprintf('Secret "%s" encrypted in "%s"; you can commit it.', $name, $this->getPrettyPath(\dirname($this->pathPrefix).\DIRECTORY_SEPARATOR));
9696
}
@@ -142,7 +142,7 @@ public function remove(string $name): bool
142142

143143
$list = $this->list();
144144
unset($list[$name]);
145-
file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", VarExporter::export($list), \LOCK_EX));
145+
file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", VarExporter::export($list)), \LOCK_EX);
146146

147147
$this->lastMessage = sprintf('Secret "%s" removed from "%s".', $name, $this->getPrettyPath(\dirname($this->pathPrefix).\DIRECTORY_SEPARATOR));
148148

src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php

+33
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,39 @@ public function testAuth()
217217
Connection::fromDsn('redis://password@localhost/queue', [], $redis);
218218
}
219219

220+
public function testAuthFromOptions()
221+
{
222+
$redis = $this->createMock(\Redis::class);
223+
224+
$redis->expects($this->exactly(1))->method('auth')
225+
->with('password')
226+
->willReturn(true);
227+
228+
Connection::fromDsn('redis://localhost/queue', ['auth' => 'password'], $redis);
229+
}
230+
231+
public function testAuthFromOptionsAndDsn()
232+
{
233+
$redis = $this->createMock(\Redis::class);
234+
235+
$redis->expects($this->exactly(1))->method('auth')
236+
->with('password2')
237+
->willReturn(true);
238+
239+
Connection::fromDsn('redis://password1@localhost/queue', ['auth' => 'password2'], $redis);
240+
}
241+
242+
public function testAuthAsUserInDsn()
243+
{
244+
$redis = $this->createMock(\Redis::class);
245+
246+
$redis->expects($this->exactly(1))->method('auth')
247+
->with('password')
248+
->willReturn(true);
249+
250+
Connection::fromDsn('redis://password:localhost/queue', [], $redis);
251+
}
252+
220253
public function testNoAuthWithEmptyPassword()
221254
{
222255
$redis = $this->createMock(\Redis::class);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public static function fromDsn(string $dsn, array $redisOptions = [], $redis = n
231231
$connectionCredentials = [
232232
'host' => $parsedUrl['host'] ?? '127.0.0.1',
233233
'port' => $parsedUrl['port'] ?? 6379,
234-
'auth' => $parsedUrl['pass'] ?? $parsedUrl['user'] ?? null,
234+
'auth' => $redisOptions['auth'] ?? $parsedUrl['pass'] ?? $parsedUrl['user'] ?? null,
235235
];
236236

237237
$pathParts = explode('/', rtrim($parsedUrl['path'] ?? '', '/'));

src/Symfony/Contracts/Cache/CacheTrait.php

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ trait CacheTrait
2727
{
2828
/**
2929
* {@inheritdoc}
30+
*
31+
* @return mixed
3032
*/
3133
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
3234
{

src/Symfony/Contracts/HttpClient/Test/TestHttpServer.php

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ class TestHttpServer
1818
{
1919
private static $process = [];
2020

21+
/**
22+
* @return Process
23+
*/
2124
public static function start(int $port = 8057)
2225
{
2326
if (isset(self::$process[$port])) {

src/Symfony/Contracts/Service/ServiceSubscriberTrait.php

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public static function getSubscribedServices(): array
5252

5353
/**
5454
* @required
55+
*
56+
* @return ContainerInterface|null
5557
*/
5658
public function setContainer(ContainerInterface $container)
5759
{

src/Symfony/Contracts/Service/Test/ServiceLocatorTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
abstract class ServiceLocatorTest extends TestCase
1919
{
20+
/**
21+
* @return ContainerInterface
22+
*/
2023
protected function getServiceLocator(array $factories)
2124
{
2225
return new class($factories) implements ContainerInterface {

src/Symfony/Contracts/Tests/Service/ServiceSubscriberTraitTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function aParentService(): Service1
4242
{
4343
}
4444

45-
public function setContainer(ContainerInterface $container)
45+
public function setContainer(ContainerInterface $container): ContainerInterface
4646
{
4747
return $container;
4848
}

src/Symfony/Contracts/Translation/Test/TranslatorTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ protected function tearDown(): void
4343
\Locale::setDefault($this->defaultLocale);
4444
}
4545

46+
/**
47+
* @return TranslatorInterface
48+
*/
4649
public function getTranslator()
4750
{
4851
return new class() implements TranslatorInterface {

0 commit comments

Comments
 (0)