src/mako/syringe/Container.php
public function replace(string $hint, $class, bool $singleton = false): void
	{
		$hint = $this->resolveAlias($hint);

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

		$this->hints[$hint]['class'] = $class;

		if($singleton)
		{
			unset($this->instances[$hint]);
		}

		$this->replaceInstances($hint);
	}
public function replace(string $hint, $class, bool $singleton = false): void
	{
		$hint = $this->resolveAlias($hint);

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

		$this->hints[$hint]['class'] = $class;

		if($singleton)
		{
			unset($this->instances[$hint]);
		}

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

@param  string                                      $hint      Type hint
@param  string|\Closure                             $class     Class name or closure
@param  bool                                        $singleton Are we replacing a singleton?
@throws \mako\syringe\exceptions\ContainerException
Replaces a registered type hint .