Skip to content

Add example how to turn off strict mode in yaml for ScopeWideningInjectionException #1707

@stloyd

Description

@stloyd

In case of:

services: service_name: class: Some\Class\Here arguments: [@request]

ScopeWideningInjectionException probably will be throw, and as described in this exception message:

(...) In rare, special cases however that might not be necessary, then you can set the reference to strict=false to get rid of this error.

In case of xml or php it's simple, but when it comes to yaml it looks like:

services: service_name: class: Some\Class\Here arguments: [@request=]

Metadata

Metadata

Assignees

No one assigned

    Labels

    DependencyInjectionactionableClear and specific issues ready for anyone to take them.good first issueIdeal for your first contribution! (some Symfony experience may be required)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions