Skip to content

Anonymous services do not work for global classes #22146

Closed
@curry684

Description

@curry684
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version dev-master

Using the standard Twig Extensions library, the following definitions work as expected:

services:
    _defaults:
        public: false
        tags: [ twig.extension ]

    random.name:
        class: Twig_Extensions_Extension_Intl

While the following doesn't:

services:
    _defaults:
        public: false
        tags: [ twig.extension ]

    Twig_Extensions_Extension_Intl: ~

It throws:

The definition for "Twig_Extensions_Extension_Intl" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.

It seems to be related to the fact that it's a class in the global namespace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions