Skip to content

lint:container callable method parameters #36607

@Nemo64

Description

@Nemo64

Symfony version(s) affected: 4.4.7

Description
I tried to configure Guzzle with middlewares completly in yaml.
I tried to push a middleware into a handler stack. The method requires a parameter with the type callable and gets a Closure. It works fine but when i run lint:container, I get: argument 1 of "GuzzleHttp\HandlerStack::push" accepts "callable", "Closure" passed.

It still works, but the linter complains.

How to reproduce

    aws.http_client_handler_stack:
        class: GuzzleHttp\HandlerStack
        factory: [GuzzleHttp\HandlerStack, create]
        calls:
            - [push, ['@aws.http_logger']]
    aws.http_logger:
        class: Closure
        factory: [GuzzleHttp\Middleware, log]
        arguments:
            - '@logger'
            - '@aws.log_formatter'
        tags:
            - {name: monolog.logger, channel: aws}
    aws.log_formatter:
        class: GuzzleHttp\MessageFormatter
        arguments:
            - '{method} {uri} HTTP/{version} {code}'

Possible Solution
The linter should check types similar to the option resolver probably needs to know of the callable type.

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