src/mako/syringe/Container.php
public function replaceInstance(string $hint, object $instance): void
	{
		$hint = $this->resolveAlias($hint);

		if(!isset($this->instances[$hint]))
		{
			throw new ContainerException(vsprintf('Unable to replace [ %s ] as it hasn\'t been registered.', [$hint]));
		}

		$this->instances[$hint] = $instance;

		$this->replaceInstances($hint);
	}
public function replaceInstance(string $hint, object $instance): void
	{
		$hint = $this->resolveAlias($hint);

		if(!isset($this->instances[$hint]))
		{
			throw new ContainerException(vsprintf('Unable to replace [ %s ] as it hasn\'t been registered.', [$hint]));
		}

		$this->instances[$hint] = $instance;

		$this->replaceInstances($hint);
	}
public function replaceInstance ( string $ hint , object $ instance ) : void { $ hint = $ this -> resolveAlias ( $ hint ) ; if ( ! isset ( $ this -> instances [ $ hint ] ) ) { throw new ContainerException ( vsprintf ( 'Unable to replace [ %s ] as it hasn\'t been registered.' , [ $ hint ] ) ) ; } $ this -> instances [ $ hint ] = $ instance ; $ this -> replaceInstances ( $ hint ) ; }
Replaces a singleton instance.

@param  string                                      $hint     Type hint
@param  object                                      $instance Class instance
@throws \mako\syringe\exceptions\ContainerException
Replaces a singleton instance .