Skip to content

[4.x] CallableResolver is misused as Container provider #2590

Description

@bnf

#2555 introduced a new method getContainer for the CallableResolverInterface.
This is actually a hack that is used to hide a real dependency to the ContainerInterface. Classes that use CallableResolverInterface::getContainer need to be refactored to depend on ContainerInterface directly and the method CallableResolverInterface::getContainer should be removed again.

Here is an example how Slim\Routable uses the CallableResolver to fetch the container:
$this->callableResolver->getContainer():

Slim/Slim/Routable.php

Lines 63 to 64 in 5311e95

if (is_string($middleware)) {
$middleware = new DeferredResolutionMiddleware($middleware, $this->callableResolver->getContainer());

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions