src/Injector.php
public function singleton(string $className, array $params = null): void
    {
        if (! is_null($params)) {
            $this->config->registerClassParameters($className, $params);
        }
        $this->config->registerSingleton($className);
    }
public function singleton(string $className, array $params = null): void
    {
        if (! is_null($params)) {
            $this->config->registerClassParameters($className, $params);
        }
        $this->config->registerSingleton($className);
    }
public function singleton ( string $ className , array $ params = null ) : void { if ( ! is_null ( $ params ) ) { $ this -> config -> registerClassParameters ( $ className , $ params ) ; } $ this -> config -> registerSingleton ( $ className ) ; }
Treat the class as a singleton.

The injector will only create one instance of this class and
return this instance on subsequent calls.

Custom parameters provided to instantiate() will be ignored.

You can update the parameter config for the singleton by calling
singleton() again, unless the class is instantiated.

If you already have an instance that you want to provide, use
intercept().
Treat the class as a singleton .