Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Invalid phpdoc for Autoconfigure attribute $calls property #57311

Closed
@fracsi

Description

@fracsi

Symfony version(s) affected

7.1.*

Description

Using the phpdoc param type for $calls (array<string, array<array-key, mixed>>) results in: Invalid method call for service "App\TestService", did you forgot a leading dash before "testFunc: ..." in "App\TestService"?

How to reproduce

Create a service with #[Autoconfigure] attribute, with calls property

#[Autoconfigure(calls: [
  'testFunc' => ['arg'],
])
class TestService {
   public function testFunc($arg) {}
}

Possible Solution

No response

Additional Context

Using the format: [['testFunc', ['arg']]] or [['testFunc' => ['arg']]] works as expected, but phpstan reports as error, becuse of parameter type mismatch

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