src/Container.php
public function has($key) : bool
    {
        try {
            $this->get($key);
            return true;
        } catch (NotFoundExceptionInterface $e) {
            return false;
        }
    }
public function has($key) : bool
    {
        try {
            $this->get($key);
            return true;
        } catch (NotFoundExceptionInterface $e) {
            return false;
        }
    }
public function has ( $ key ) : bool { try { $ this -> get ( $ key ) ; return true ; } catch ( NotFoundExceptionInterface $ e ) { return false ; } }
Checks if a dependency exists identified by $key. Note that this also
resolves the dependency internally, so any dependencies on $key must also
be resolvable for this to return true.

Note `$key` is not type hinted as it would violate the
`Psr\Container\ContainerInterface`.

@param string $key The unique identifier for the dependency.
@return bool True if $key identifies a known dependency, else false.
Checks if a dependency exists identified by $key . Note that this also resolves the dependency internally so any dependencies on $key must also be resolvable for this to return true .