fix parsing calls of methods named "method"
This commit is contained in:
parent
cc606003a5
commit
a9de390676
@ -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));
|
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'];
|
$method = $call['method'];
|
||||||
$args = $call['arguments'] ?? [];
|
$args = $call['arguments'] ?? [];
|
||||||
$returnsClone = $call['returns_clone'] ?? false;
|
$returnsClone = $call['returns_clone'] ?? false;
|
||||||
|
@ -3,3 +3,5 @@ services:
|
|||||||
calls:
|
calls:
|
||||||
- foo: [1, 2, 3]
|
- foo: [1, 2, 3]
|
||||||
- bar: !returns_clone [1, 2, 3]
|
- bar: !returns_clone [1, 2, 3]
|
||||||
|
- method:
|
||||||
|
- url
|
||||||
|
@ -968,6 +968,7 @@ class YamlFileLoaderTest extends TestCase
|
|||||||
$expected = [
|
$expected = [
|
||||||
['foo', [1, 2, 3]],
|
['foo', [1, 2, 3]],
|
||||||
['bar', [1, 2, 3], true],
|
['bar', [1, 2, 3], true],
|
||||||
|
['method', ['url']],
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->assertSame($expected, $container->getDefinition('foo')->getMethodCalls());
|
$this->assertSame($expected, $container->getDefinition('foo')->getMethodCalls());
|
||||||
|
Reference in New Issue
Block a user