Automattic\WooCommerce\Internal\DependencyManagement
AbstractServiceProvider::share_with_auto_arguments()
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.
Method of the class: AbstractServiceProvider{}
No Hooks.
Return
DefinitionInterface
. The generated container definition.
Usage
// 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.
- $concrete(mixed)
- The concrete to register. Can be a shared instance, a factory callback, or a class name.
Default: null
AbstractServiceProvider::share_with_auto_arguments() AbstractServiceProvider::share with auto arguments code WC 8.7.0
protected function share_with_auto_arguments( string $class_name, $concrete = null ) : DefinitionInterface { return $this->add_with_auto_arguments( $class_name, $concrete, true ); }