Skip to content

bug: Container::singleton() not defined, breaks Messaging and Tickets extensions #396

Description

@LennyObez

Summary

The `Pulsar\Container\Container` class does not have a `singleton()` method. Extensions that call `$container->singleton()` fail during registration with:

```
Call to undefined method Pulsar\Container\Container::singleton()
```

Affected extensions

  • `pulsar/messaging` -- `MessagingServiceProvider.php`
  • `pulsar/tickets` -- `TicketsServiceProvider.php`

Current behavior

The `bind()` method defaults to `BindingType::Singleton`, so singleton registration is already the default behavior. But the explicit `singleton()` convenience method does not exist.

When the resilient ExtensionBootstrap loads these extensions successfully (the classes are found), they fail at the register phase. The Kernel does not catch registration errors gracefully, so the entire boot process fails.

Expected behavior

Either:

  1. Add `Container::singleton(string $id, callable|string $concrete): void` as an alias for `bind($id, $concrete, BindingType::Singleton)`
  2. Or make the Kernel's extension register phase resilient (skip and warn on failure, like `loadFromPaths` now does for loading)

Impact

Even with the resilient `loadFromPaths` fix, the Kernel boot fails because Messaging loads but cannot register. This blocks `pulsar serve`, `pulsar cms:import`, and all web requests.

Environment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingextensionExtension system

Projects

Status
Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions