Skip to content

YAML service configuration cannot call a method called "method" #40349

@Bilge

Description

@Bilge

Symfony version(s) affected: 5.2.3

Description
If a service has a method called method, such as Zebra_Pagination has, it is not possible to declare calls to such a method in YAML.

How to reproduce

services:
  Zebra_Pagination:
    class: Zebra_Pagination
    calls:
      - method:
        - url
      - padding:
        - false

Note the call syntax is correct because the call to padding() alone (and others) succeeds, only the call to method() fails because Symfony interprets the configuration differently for a key called method for some (legacy?) reason.

The specific error thrown is:

Invalid service "Zebra_Pagination": method "url()" does not exist.
dependency-injection\Compiler\AbstractRecursivePass.php (line 186)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions