You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
README.MD: # Using deferred service providers [link]
// returns false as provider wasn't registered$container->has(EngineInterface::class);
// returns SolarEngine, registered in the provider$engine = $container->get(EngineInterface::class);
// returns true as provider was registered when EngineInterface was requested from the container$container->has(EngineInterface::class);
PSR about has():
1.1.2 Reading from a container
has takes one unique parameter: an entry identifier, which MUST be a string. has MUST return true if an entry identifier is known to the container and false if it is not. If has($id) returns false, get($id) MUST throw a NotFoundExceptionInterface.
/** * Returns true if the container can return an entry for the given identifier. * Returns false otherwise. * * `has($id)` returning true does not mean that `get($id)` will not throw an exception. * It does however mean that `get($id)` will not throw a `NotFoundExceptionInterface`. * * @param string $id Identifier of the entry to look for. * * @return bool */public function has($id);
Method get() must returns true if the container can return an entry for the given identifier.
In our case, it returns false until the first call to get()
The text was updated successfully, but these errors were encountered:
roxblnfk
changed the title
Incorrect work of Factoryprovider->has()
Incorrect work of FactoryProvider->has()
Feb 13, 2020
README.MD: # Using deferred service providers [link]
PSR about
has()
:Method
get()
must returnstrue
if the container can return an entry for the given identifier.In our case, it returns
false
until the first call toget()
The text was updated successfully, but these errors were encountered: