fix parsing calls of methods named "method"

This commit is contained in:
Christian Flothmann 2021-03-03 13:08:43 +01:00
parent cc606003a5
commit a9de390676
3 changed files with 4 additions and 1 deletions

View File

@ -471,7 +471,7 @@ class YamlFileLoader extends FileLoader
throw new InvalidArgumentException(sprintf('Invalid method call for service "%s", did you forgot a leading dash before "%s: ..." in "%s"?', $id, $k, $file));
}
if (isset($call['method'])) {
if (isset($call['method']) && \is_string($call['method'])) {
$method = $call['method'];
$args = $call['arguments'] ?? [];
$returnsClone = $call['returns_clone'] ?? false;

View File

@ -3,3 +3,5 @@ services:
calls:
- foo: [1, 2, 3]
- bar: !returns_clone [1, 2, 3]
- method:
- url

View File

@ -968,6 +968,7 @@ class YamlFileLoaderTest extends TestCase
$expected = [
['foo', [1, 2, 3]],
['bar', [1, 2, 3], true],
['method', ['url']],
];
$this->assertSame($expected, $container->getDefinition('foo')->getMethodCalls());