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 6dc7d8b

Browse filesBrowse files
Merge branch '5.0'
* 5.0: [PhpUnitBridge] add PolyfillTestCaseTrait::expectExceptionMessageMatches to provide FC with recent phpunit versions [Messenger] Make sure redis transports are initialized correctly Remove return type for Twig function workflow_metadata() [DI] fix typo
2 parents b2f210f + 4f8f374 commit 6dc7d8b
Copy full SHA for 6dc7d8b

File tree

29 files changed

+78
-54
lines changed
Filter options

29 files changed

+78
-54
lines changed

‎composer.json

Copy file name to clipboardExpand all lines: composer.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
"psr/http-client": "^1.0",
125125
"psr/simple-cache": "^1.0",
126126
"egulias/email-validator": "~1.2,>=1.2.8|~2.0",
127-
"symfony/phpunit-bridge": "^3.4.31|^4.3.4|~5.0",
127+
"symfony/phpunit-bridge": "^5.0.8",
128128
"symfony/security-acl": "~2.8|~3.0",
129129
"phpdocumentor/reflection-docblock": "^3.0|^4.0",
130130
"twig/cssinliner-extra": "^2.12",

‎src/Symfony/Bridge/PhpUnit/Legacy/PolyfillTestCaseTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Legacy/PolyfillTestCaseTrait.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ public function expectExceptionMessage($message)
9595
$property->setValue($this, $message);
9696
}
9797

98+
/**
99+
* @param string $messageRegExp
100+
*
101+
* @return void
102+
*/
103+
public function expectExceptionMessageMatches($messageRegExp)
104+
{
105+
$this->expectExceptionMessageRegExp($messageRegExp);
106+
}
107+
98108
/**
99109
* @param string $messageRegExp
100110
*

‎src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function getMarkedPlaces(object $subject, bool $placesNameOnly = true, st
9595
* Use a string (the place name) to get place metadata
9696
* Use a Transition instance to get transition metadata
9797
*/
98-
public function getMetadata(object $subject, string $key, $metadataSubject = null, string $name = null): ?string
98+
public function getMetadata(object $subject, string $key, $metadataSubject = null, string $name = null)
9999
{
100100
return $this
101101
->workflowRegistry

‎src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function testGetPattern()
6666
public function testResourceDoesNotExist()
6767
{
6868
$this->expectException('InvalidArgumentException');
69-
$this->expectExceptionMessageRegExp('/The directory ".*" does not exist./');
69+
$this->expectExceptionMessageMatches('/The directory ".*" does not exist./');
7070
new DirectoryResource('/____foo/foobar'.mt_rand(1, 999999));
7171
}
7272

‎src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function testToString()
5656
public function testResourceDoesNotExist()
5757
{
5858
$this->expectException('InvalidArgumentException');
59-
$this->expectExceptionMessageRegExp('/The file ".*" does not exist./');
59+
$this->expectExceptionMessageMatches('/The file ".*" does not exist./');
6060
new FileResource('/____foo/foobar'.mt_rand(1, 999999));
6161
}
6262

‎src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ private function resolveServices($value, string $file, bool $isParameter = false
754754

755755
if (\is_array($argument) && isset($argument['tag']) && $argument['tag']) {
756756
if ($diff = array_diff(array_keys($argument), ['tag', 'index_by', 'default_index_method', 'default_priority_method'])) {
757-
throw new InvalidArgumentException(sprintf('"!%s" tag contains unsupported key "%s"; supported ones are "tag", "index_by", "default_index_method", and "default_priority_method".', $value->getTag(), implode('"", "', $diff)));
757+
throw new InvalidArgumentException(sprintf('"!%s" tag contains unsupported key "%s"; supported ones are "tag", "index_by", "default_index_method", and "default_priority_method".', $value->getTag(), implode('", "', $diff)));
758758
}
759759

760760
$argument = new TaggedIteratorArgument($argument['tag'], $argument['index_by'] ?? null, $argument['default_index_method'] ?? null, $forLocator, $argument['default_priority_method'] ?? null);

‎src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveChildDefinitionsPassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveChildDefinitionsPassTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ protected function process(ContainerBuilder $container)
405405
public function testProcessDetectsChildDefinitionIndirectCircularReference()
406406
{
407407
$this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException');
408-
$this->expectExceptionMessageRegExp('/^Circular reference detected for service "c", path: "c -> b -> a -> c"./');
408+
$this->expectExceptionMessageMatches('/^Circular reference detected for service "c", path: "c -> b -> a -> c"./');
409409
$container = new ContainerBuilder();
410410

411411
$container->register('a');

‎src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public function testProcessForAutoconfiguredCalls()
233233
public function testProcessThrowsExceptionForArguments()
234234
{
235235
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
236-
$this->expectExceptionMessageRegExp('/Autoconfigured instanceof for type "PHPUnit[\\\\_]Framework[\\\\_]TestCase" defines arguments but these are not supported and should be removed\./');
236+
$this->expectExceptionMessageMatches('/Autoconfigured instanceof for type "PHPUnit[\\\\_]Framework[\\\\_]TestCase" defines arguments but these are not supported and should be removed\./');
237237
$container = new ContainerBuilder();
238238
$container->registerForAutoconfiguration(parent::class)
239239
->addArgument('bar');

‎src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function testInvalidEnvInConfig()
101101
public function testNulledEnvInConfig()
102102
{
103103
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
104-
$this->expectExceptionMessageRegexp('/^Invalid type for path "env_extension\.int_node"\. Expected "?int"?, but got (NULL|"null")\.$/');
104+
$this->expectExceptionMessageMatches('/^Invalid type for path "env_extension\.int_node"\. Expected "?int"?, but got (NULL|"null")\.$/');
105105
$container = new ContainerBuilder();
106106
$container->setParameter('env(NULLED)', null);
107107
$container->registerExtension(new EnvExtension());

‎src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public function testMissingParentClass()
216216
public function testRegisterClassesWithBadPrefix()
217217
{
218218
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
219-
$this->expectExceptionMessageRegExp('/Expected to find class "Symfony\\\Component\\\DependencyInjection\\\Tests\\\Fixtures\\\Prototype\\\Bar" in file ".+" while importing services from resource "Prototype\/Sub\/\*", but it was not found\! Check the namespace prefix used with the resource/');
219+
$this->expectExceptionMessageMatches('/Expected to find class "Symfony\\\Component\\\DependencyInjection\\\Tests\\\Fixtures\\\Prototype\\\Bar" in file ".+" while importing services from resource "Prototype\/Sub\/\*", but it was not found\! Check the namespace prefix used with the resource/');
220220
$container = new ContainerBuilder();
221221
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
222222

‎src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public function testParseTagsWithoutNameThrowsException()
380380
public function testParseTagWithEmptyNameThrowsException()
381381
{
382382
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
383-
$this->expectExceptionMessageRegExp('/The tag name for service ".+" in .* must be a non-empty string/');
383+
$this->expectExceptionMessageMatches('/The tag name for service ".+" in .* must be a non-empty string/');
384384
$container = new ContainerBuilder();
385385
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
386386
$loader->load('tag_with_empty_name.xml');

‎src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
+12-12Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static function setUpBeforeClass(): void
5050
public function testLoadUnExistFile()
5151
{
5252
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
53-
$this->expectExceptionMessageRegExp('/The file ".+" does not exist./');
53+
$this->expectExceptionMessageMatches('/The file ".+" does not exist./');
5454
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/ini'));
5555
$r = new \ReflectionObject($loader);
5656
$m = $r->getMethod('loadFile');
@@ -62,7 +62,7 @@ public function testLoadUnExistFile()
6262
public function testLoadInvalidYamlFile()
6363
{
6464
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
65-
$this->expectExceptionMessageRegExp('/The file ".+" does not contain valid YAML./');
65+
$this->expectExceptionMessageMatches('/The file ".+" does not contain valid YAML./');
6666
$path = self::$fixturesPath.'/ini';
6767
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator($path));
6868
$r = new \ReflectionObject($loader);
@@ -385,15 +385,15 @@ public function testLoadYamlOnlyWithKeys()
385385
public function testTagWithEmptyNameThrowsException()
386386
{
387387
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
388-
$this->expectExceptionMessageRegExp('/The tag name for service ".+" in .+ must be a non-empty string/');
388+
$this->expectExceptionMessageMatches('/The tag name for service ".+" in .+ must be a non-empty string/');
389389
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
390390
$loader->load('tag_name_empty_string.yml');
391391
}
392392

393393
public function testTagWithNonStringNameThrowsException()
394394
{
395395
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
396-
$this->expectExceptionMessageRegExp('/The tag name for service ".+" in .+ must be a non-empty string/');
396+
$this->expectExceptionMessageMatches('/The tag name for service ".+" in .+ must be a non-empty string/');
397397
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
398398
$loader->load('tag_name_no_string.yml');
399399
}
@@ -494,7 +494,7 @@ public function testPrototypeWithNamespace()
494494
public function testPrototypeWithNamespaceAndNoResource()
495495
{
496496
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
497-
$this->expectExceptionMessageRegExp('/A "resource" attribute must be set when the "namespace" attribute is set for service ".+" in .+/');
497+
$this->expectExceptionMessageMatches('/A "resource" attribute must be set when the "namespace" attribute is set for service ".+" in .+/');
498498
$container = new ContainerBuilder();
499499
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
500500
$loader->load('services_prototype_namespace_without_resource.yml');
@@ -622,7 +622,7 @@ public function testDecoratedServicesWithWrongOnInvalidSyntaxThrowsException()
622622
public function testInvalidTagsWithDefaults()
623623
{
624624
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
625-
$this->expectExceptionMessageRegExp('/Parameter "tags" must be an array for service "Foo\\\Bar" in ".+services31_invalid_tags\.yml"\. Check your YAML syntax./');
625+
$this->expectExceptionMessageMatches('/Parameter "tags" must be an array for service "Foo\\\Bar" in ".+services31_invalid_tags\.yml"\. Check your YAML syntax./');
626626
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
627627
$loader->load('services31_invalid_tags.yml');
628628
}
@@ -712,7 +712,7 @@ public function testAnonymousServicesInInstanceof()
712712
public function testAnonymousServicesWithAliases()
713713
{
714714
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
715-
$this->expectExceptionMessageRegExp('/Creating an alias using the tag "!service" is not allowed in ".+anonymous_services_alias\.yml"\./');
715+
$this->expectExceptionMessageMatches('/Creating an alias using the tag "!service" is not allowed in ".+anonymous_services_alias\.yml"\./');
716716
$container = new ContainerBuilder();
717717
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
718718
$loader->load('anonymous_services_alias.yml');
@@ -721,7 +721,7 @@ public function testAnonymousServicesWithAliases()
721721
public function testAnonymousServicesInParameters()
722722
{
723723
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
724-
$this->expectExceptionMessageRegExp('/Using an anonymous service in a parameter is not allowed in ".+anonymous_services_in_parameters\.yml"\./');
724+
$this->expectExceptionMessageMatches('/Using an anonymous service in a parameter is not allowed in ".+anonymous_services_in_parameters\.yml"\./');
725725
$container = new ContainerBuilder();
726726
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
727727
$loader->load('anonymous_services_in_parameters.yml');
@@ -740,7 +740,7 @@ public function testAutoConfigureInstanceof()
740740
public function testEmptyDefaultsThrowsClearException()
741741
{
742742
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
743-
$this->expectExceptionMessageRegExp('/Service "_defaults" key must be an array, "null" given in ".+bad_empty_defaults\.yml"\./');
743+
$this->expectExceptionMessageMatches('/Service "_defaults" key must be an array, "null" given in ".+bad_empty_defaults\.yml"\./');
744744
$container = new ContainerBuilder();
745745
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
746746
$loader->load('bad_empty_defaults.yml');
@@ -749,7 +749,7 @@ public function testEmptyDefaultsThrowsClearException()
749749
public function testEmptyInstanceofThrowsClearException()
750750
{
751751
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
752-
$this->expectExceptionMessageRegExp('/Service "_instanceof" key must be an array, "null" given in ".+bad_empty_instanceof\.yml"\./');
752+
$this->expectExceptionMessageMatches('/Service "_instanceof" key must be an array, "null" given in ".+bad_empty_instanceof\.yml"\./');
753753
$container = new ContainerBuilder();
754754
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
755755
$loader->load('bad_empty_instanceof.yml');
@@ -758,7 +758,7 @@ public function testEmptyInstanceofThrowsClearException()
758758
public function testUnsupportedKeywordThrowsException()
759759
{
760760
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
761-
$this->expectExceptionMessageRegExp('/^The configuration key "private" is unsupported for definition "bar"/');
761+
$this->expectExceptionMessageMatches('/^The configuration key "private" is unsupported for definition "bar"/');
762762
$container = new ContainerBuilder();
763763
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
764764
$loader->load('bad_keyword.yml');
@@ -767,7 +767,7 @@ public function testUnsupportedKeywordThrowsException()
767767
public function testUnsupportedKeywordInServiceAliasThrowsException()
768768
{
769769
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
770-
$this->expectExceptionMessageRegExp('/^The configuration key "calls" is unsupported for the service "bar" which is defined as an alias/');
770+
$this->expectExceptionMessageMatches('/^The configuration key "calls" is unsupported for the service "bar" which is defined as an alias/');
771771
$container = new ContainerBuilder();
772772
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
773773
$loader->load('bad_alias.yml');

‎src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public function testRegisterAfterEval($registerCallback)
231231
public function testCallBadCallable()
232232
{
233233
$this->expectException('RuntimeException');
234-
$this->expectExceptionMessageRegExp('/Unable to call method "\w+" of object "\w+"./');
234+
$this->expectExceptionMessageMatches('/Unable to call method "\w+" of object "\w+"./');
235235
$el = new ExpressionLanguage();
236236
$el->evaluate('foo.myfunction()', ['foo' => new \stdClass()]);
237237
}

‎src/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public function provideCustomFalseValues()
197197
public function testDontAllowNonArrayFalseValues()
198198
{
199199
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
200-
$this->expectExceptionMessageRegExp('/"false_values" with value "invalid" is expected to be of type "array"/');
200+
$this->expectExceptionMessageMatches('/"false_values" with value "invalid" is expected to be of type "array"/');
201201
$this->factory->create(static::TESTED_TYPE, null, [
202202
'false_values' => 'invalid',
203203
]);

‎src/Symfony/Component/Mailer/Tests/Transport/Smtp/Stream/SocketStreamTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Tests/Transport/Smtp/Stream/SocketStreamTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class SocketStreamTest extends TestCase
1919
public function testSocketErrorNoConnection()
2020
{
2121
$this->expectException('Symfony\Component\Mailer\Exception\TransportException');
22-
$this->expectExceptionMessageRegExp('/Connection refused|unable to connect/');
22+
$this->expectExceptionMessageMatches('/Connection refused|unable to connect/');
2323
$s = new SocketStream();
2424
$s->setTimeout(0.1);
2525
$s->setPort(9999);
@@ -29,7 +29,7 @@ public function testSocketErrorNoConnection()
2929
public function testSocketErrorBeforeConnectError()
3030
{
3131
$this->expectException('Symfony\Component\Mailer\Exception\TransportException');
32-
$this->expectExceptionMessageRegExp('/no valid certs found cafile stream|Unable to find the socket transport "ssl"/');
32+
$this->expectExceptionMessageMatches('/no valid certs found cafile stream|Unable to find the socket transport "ssl"/');
3333
$s = new SocketStream();
3434
$s->setStreamOptions([
3535
'ssl' => [

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ public function testFromDsnWithOptions()
7676
);
7777
}
7878

79+
public function testFromDsnWithOptionsAndTrailingSlash()
80+
{
81+
$this->assertEquals(
82+
Connection::fromDsn('redis://localhost/', ['stream' => 'queue', 'group' => 'group1', 'consumer' => 'consumer1', 'auto_setup' => false, 'serializer' => 2]),
83+
Connection::fromDsn('redis://localhost/queue/group1/consumer1?serializer=2&auto_setup=0')
84+
);
85+
}
86+
7987
public function testFromDsnWithTls()
8088
{
8189
$redis = $this->createMock(\Redis::class);

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,17 @@ public function __construct(array $configuration, array $connectionCredentials =
6262
$this->connection->setOption(\Redis::OPT_SERIALIZER, $redisOptions['serializer'] ?? \Redis::SERIALIZER_PHP);
6363

6464
if (isset($connectionCredentials['auth']) && !$this->connection->auth($connectionCredentials['auth'])) {
65-
throw new InvalidArgumentException(sprintf('Redis connection failed: %s.', $redis->getLastError()));
65+
throw new InvalidArgumentException('Redis connection failed: '.$redis->getLastError());
6666
}
6767

6868
if (($dbIndex = $configuration['dbindex'] ?? self::DEFAULT_OPTIONS['dbindex']) && !$this->connection->select($dbIndex)) {
69-
throw new InvalidArgumentException(sprintf('Redis connection failed: %s.', $redis->getLastError()));
69+
throw new InvalidArgumentException('Redis connection failed: '.$redis->getLastError());
70+
}
71+
72+
foreach (['stream', 'group', 'consumer'] as $key) {
73+
if (isset($configuration[$key]) && '' === $configuration[$key]) {
74+
throw new InvalidArgumentException(sprintf('"%s" should be configured, got an empty string.', $key));
75+
}
7076
}
7177

7278
$this->stream = $configuration['stream'] ?? self::DEFAULT_OPTIONS['stream'];
@@ -150,7 +156,7 @@ public static function fromDsn(string $dsn, array $redisOptions = [], \Redis $re
150156
'auth' => $parsedUrl['pass'] ?? $parsedUrl['user'] ?? null,
151157
];
152158

153-
$pathParts = explode('/', $parsedUrl['path'] ?? '');
159+
$pathParts = explode('/', rtrim($parsedUrl['path'] ?? '', '/'));
154160

155161
$configuration['stream'] = $pathParts[1] ?? $configuration['stream'];
156162
$configuration['group'] = $pathParts[2] ?? $configuration['group'];

0 commit comments

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