EnvironmentInterface
seems to be a useless type to expect / depend on
#2548
Labels
EnvironmentInterface
seems to be a useless type to expect / depend on
#2548
Slim\Container
declares defaultenvironment
service to be an implementation ofEnvironmentInterface
.Thing is
EnvironmentInterface
doesn’t contain anything actually needed for it to work, only test–relatedmock()
.This means that this
$app->getContainer()->environment->get('foo');
won’t be understood by any tools, because the interface doesn’t haveget()
.Also the classes that depend on environment like
Slim\Http\Request::createFromEnvironment(Environment $environment)
all require specificSlim\Environment
class, not the interface. So trying to replaceenvironment
service with something that implementsEnvironmentInterface
would break the app.It feels like either:
EnvironmentInterface
should be expanded to comprehensively describe a generic replaceable service, in analogue toContainerInterface
. Other components of the app should be changed to depend on the interface, not the implementation.Environment
implementation, not the interface.The text was updated successfully, but these errors were encountered: