Skip to content

Commit aebbe95

Browse 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 5c9af79 + 4c8170d commit aebbe95

7 files changed

+18
-18
lines changed

Loader/YamlFileLoader.php

Lines 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);

Tests/Compiler/ResolveChildDefinitionsPassTest.php

Lines 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');

Tests/Compiler/ResolveInstanceofConditionalsPassTest.php

Lines 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');

Tests/Compiler/ValidateEnvPlaceholdersPassTest.php

Lines 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());

Tests/Loader/FileLoaderTest.php

Lines 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

Tests/Loader/XmlFileLoaderTest.php

Lines 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');

Tests/Loader/YamlFileLoaderTest.php

Lines 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');

0 commit comments

Comments
 (0)