Skip to content

Missing service alias for WebPush\WebPushService interface #70

Description

@Spomky

Problem

The bundle registers WebPush\WebPush as a service in the container (in Resources/config/services.php), but does not create an alias for the WebPush\WebPushService interface it implements.

This means users who properly type-hint the interface (following dependency inversion principle) get an autowiring error:

Cannot autowire service "...SendPushNotificationHandler": argument "$webPush" of method "__construct()" 
references interface "WebPush\WebPushService" but no such service exists. 
You should maybe alias this interface to one of these existing services: "WebPush\WebPush", "web_push.service".

Expected Behavior

The bundle should register an alias from WebPush\WebPushService to WebPush\WebPush so that autowiring works with the interface.

Current Workaround

Adding a manual alias in services.yaml:

WebPush\WebPushService: '@WebPush\WebPush'

Suggested Fix

In web-push-bundle/Resources/config/services.php, add:

$container->alias(WebPushService::class, WebPush::class);

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