Skip to content

Commit 4c8170d

Browse files
Merge branch '4.4' into 5.0
* 4.4: [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 35871e6 + 2e02a27 commit 4c8170d

7 files changed

+18
-18
lines changed

Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ private function resolveServices($value, string $file, bool $isParameter = false
755755

756756
if (\is_array($argument) && isset($argument['tag']) && $argument['tag']) {
757757
if ($diff = array_diff(array_keys($argument), ['tag', 'index_by', 'default_index_method', 'default_priority_method'])) {
758-
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)));
758+
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)));
759759
}
760760

761761
$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
@@ -400,7 +400,7 @@ protected function process(ContainerBuilder $container)
400400
public function testProcessDetectsChildDefinitionIndirectCircularReference()
401401
{
402402
$this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException');
403-
$this->expectExceptionMessageRegExp('/^Circular reference detected for service "c", path: "c -> b -> a -> c"./');
403+
$this->expectExceptionMessageMatches('/^Circular reference detected for service "c", path: "c -> b -> a -> c"./');
404404
$container = new ContainerBuilder();
405405

406406
$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
@@ -378,7 +378,7 @@ public function testParseTagsWithoutNameThrowsException()
378378
public function testParseTagWithEmptyNameThrowsException()
379379
{
380380
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
381-
$this->expectExceptionMessageRegExp('/The tag name for service ".+" in .* must be a non-empty string/');
381+
$this->expectExceptionMessageMatches('/The tag name for service ".+" in .* must be a non-empty string/');
382382
$container = new ContainerBuilder();
383383
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
384384
$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);
@@ -363,15 +363,15 @@ public function testLoadYamlOnlyWithKeys()
363363
public function testTagWithEmptyNameThrowsException()
364364
{
365365
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
366-
$this->expectExceptionMessageRegExp('/The tag name for service ".+" in .+ must be a non-empty string/');
366+
$this->expectExceptionMessageMatches('/The tag name for service ".+" in .+ must be a non-empty string/');
367367
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
368368
$loader->load('tag_name_empty_string.yml');
369369
}
370370

371371
public function testTagWithNonStringNameThrowsException()
372372
{
373373
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
374-
$this->expectExceptionMessageRegExp('/The tag name for service ".+" in .+ must be a non-empty string/');
374+
$this->expectExceptionMessageMatches('/The tag name for service ".+" in .+ must be a non-empty string/');
375375
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
376376
$loader->load('tag_name_no_string.yml');
377377
}
@@ -472,7 +472,7 @@ public function testPrototypeWithNamespace()
472472
public function testPrototypeWithNamespaceAndNoResource()
473473
{
474474
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
475-
$this->expectExceptionMessageRegExp('/A "resource" attribute must be set when the "namespace" attribute is set for service ".+" in .+/');
475+
$this->expectExceptionMessageMatches('/A "resource" attribute must be set when the "namespace" attribute is set for service ".+" in .+/');
476476
$container = new ContainerBuilder();
477477
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
478478
$loader->load('services_prototype_namespace_without_resource.yml');
@@ -600,7 +600,7 @@ public function testDecoratedServicesWithWrongOnInvalidSyntaxThrowsException()
600600
public function testInvalidTagsWithDefaults()
601601
{
602602
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
603-
$this->expectExceptionMessageRegExp('/Parameter "tags" must be an array for service "Foo\\\Bar" in ".+services31_invalid_tags\.yml"\. Check your YAML syntax./');
603+
$this->expectExceptionMessageMatches('/Parameter "tags" must be an array for service "Foo\\\Bar" in ".+services31_invalid_tags\.yml"\. Check your YAML syntax./');
604604
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
605605
$loader->load('services31_invalid_tags.yml');
606606
}
@@ -690,7 +690,7 @@ public function testAnonymousServicesInInstanceof()
690690
public function testAnonymousServicesWithAliases()
691691
{
692692
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
693-
$this->expectExceptionMessageRegExp('/Creating an alias using the tag "!service" is not allowed in ".+anonymous_services_alias\.yml"\./');
693+
$this->expectExceptionMessageMatches('/Creating an alias using the tag "!service" is not allowed in ".+anonymous_services_alias\.yml"\./');
694694
$container = new ContainerBuilder();
695695
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
696696
$loader->load('anonymous_services_alias.yml');
@@ -699,7 +699,7 @@ public function testAnonymousServicesWithAliases()
699699
public function testAnonymousServicesInParameters()
700700
{
701701
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
702-
$this->expectExceptionMessageRegExp('/Using an anonymous service in a parameter is not allowed in ".+anonymous_services_in_parameters\.yml"\./');
702+
$this->expectExceptionMessageMatches('/Using an anonymous service in a parameter is not allowed in ".+anonymous_services_in_parameters\.yml"\./');
703703
$container = new ContainerBuilder();
704704
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
705705
$loader->load('anonymous_services_in_parameters.yml');
@@ -718,7 +718,7 @@ public function testAutoConfigureInstanceof()
718718
public function testEmptyDefaultsThrowsClearException()
719719
{
720720
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
721-
$this->expectExceptionMessageRegExp('/Service "_defaults" key must be an array, "NULL" given in ".+bad_empty_defaults\.yml"\./');
721+
$this->expectExceptionMessageMatches('/Service "_defaults" key must be an array, "NULL" given in ".+bad_empty_defaults\.yml"\./');
722722
$container = new ContainerBuilder();
723723
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
724724
$loader->load('bad_empty_defaults.yml');
@@ -727,7 +727,7 @@ public function testEmptyDefaultsThrowsClearException()
727727
public function testEmptyInstanceofThrowsClearException()
728728
{
729729
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
730-
$this->expectExceptionMessageRegExp('/Service "_instanceof" key must be an array, "NULL" given in ".+bad_empty_instanceof\.yml"\./');
730+
$this->expectExceptionMessageMatches('/Service "_instanceof" key must be an array, "NULL" given in ".+bad_empty_instanceof\.yml"\./');
731731
$container = new ContainerBuilder();
732732
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
733733
$loader->load('bad_empty_instanceof.yml');
@@ -736,7 +736,7 @@ public function testEmptyInstanceofThrowsClearException()
736736
public function testUnsupportedKeywordThrowsException()
737737
{
738738
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
739-
$this->expectExceptionMessageRegExp('/^The configuration key "private" is unsupported for definition "bar"/');
739+
$this->expectExceptionMessageMatches('/^The configuration key "private" is unsupported for definition "bar"/');
740740
$container = new ContainerBuilder();
741741
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
742742
$loader->load('bad_keyword.yml');
@@ -745,7 +745,7 @@ public function testUnsupportedKeywordThrowsException()
745745
public function testUnsupportedKeywordInServiceAliasThrowsException()
746746
{
747747
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
748-
$this->expectExceptionMessageRegExp('/^The configuration key "calls" is unsupported for the service "bar" which is defined as an alias/');
748+
$this->expectExceptionMessageMatches('/^The configuration key "calls" is unsupported for the service "bar" which is defined as an alias/');
749749
$container = new ContainerBuilder();
750750
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
751751
$loader->load('bad_alias.yml');

0 commit comments

Comments
 (0)