AbstractServiceProvider::share_with_auto_arguments()protectedWC 1.0

Register a class in the container and use reflection to guess the injection method arguments. The class is registered as shared, so get on the container always returns the same instance.

WARNING: this method uses reflection, so please have performance in mind when using it.

{} It's a method of the class: AbstractServiceProvider{}

No Hooks.


DefinitionInterface. The generated container definition.


// protected - for code of main (parent) or child class
$result = $this->share_with_auto_arguments( $class_name, $concrete ) : DefinitionInterface;
$class_name(string) (required)
Class name to register.
The concrete to register. Can be a shared instance, a factory callback, or a class name.
Default: null

Code of AbstractServiceProvider::share_with_auto_arguments() WC 7.1.0

protected function share_with_auto_arguments( string $class_name, $concrete = null ) : DefinitionInterface {
	return $this->add_with_auto_arguments( $class_name, $concrete, true );