Automattic\WooCommerce\Internal\DependencyManagement

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.

Метод класса: AbstractServiceProvider{}

Хуков нет.

Возвращает

DefinitionInterface. The generated container definition.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->share_with_auto_arguments( $class_name, $concrete ) : DefinitionInterface;
$class_name(строка) (обязательный)
Class name to register.
$concrete(разное)
The concrete to register. Can be a shared instance, a factory callback, or a class name.
По умолчанию: null

Код AbstractServiceProvider::share_with_auto_arguments() 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 );
}