on Class has a private injection method, can't reflect class, or the concrete is invalid.
*/
private function reflect_class_or_callable( string $class_name, $concrete ) {
if ( ! isset( $concrete ) || is_string( $concrete ) && class_exists( $concrete ) ) {
$class = $concrete ?? $class_name;
if ( ! method_exists( $class, Definition::INJECTION_METHOD ) ) {
return null;
}
$method = new \ReflectionMethod( $class, Definition::INJECTION_METHOD );
$missing_modifiers = array();
if ( ! $method->isFinal() ) {
$missing_modifiers[] = 'final';
}
if ( ! $method->isPublic() ) {
$missing_modifiers[] = 'public';
}
if ( ! empty( $missing_modifiers ) ) {
throw new ContainerException( "Method '" . Definition::INJECTION_METHOD . "' of class '$class' isn't '" . implode( ' ', $missing_modifiers ) . "', instances can't be created." );
}
return $method;
} elseif ( is_callable( $concrete ) ) {
try {
return new \ReflectionFunction( $concrete );
} catch ( \ReflectionException $ex ) {
throw new ContainerException( "Error when reflecting callable: {$ex->getMessage()}" );
}
}
return null;
}
/**
* 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.
*
* @param string $class_name Class name to register.
* @param mixed $concrete The concrete to register. Can be a shared instance, a factory callback, or a class name.
*
* @return DefinitionInterface The generated container definition.
*
* @throws ContainerException Error when reflecting the class, or class injection method is not public, or an argument has no valid type hint.
*/
protected function share_with_auto_arguments( string $class_name, $concrete = null ) : DefinitionInterface {
return $this->add_with_auto_arguments( $class_name, $concrete, true );
}
/**
* Register an entry in the container.
*
* @param string $id Entry id (typically a class or interface name).
* @param mixed|null $concrete Concrete entity to register under that id, null for automatic creation.
* @param bool|null $shared Whether to register the class as shared (`get` always returns the same instance) or not.
*
* @return DefinitionInterface The generated container definition.
*/
protected function add( string $id, $concrete = null, bool $shared = null ) : DefinitionInterface {
return $this->getContainer()->add( $id, $concrete, $shared );
}
/**
* Register a shared entry in the container (`get` always returns the same instance).
*
* @param string $id Entry id (typically a class or interface name).
* @param mixed|null $concrete Concrete entity to register under that id, null for automatic creation.
*
* @return DefinitionInterface The generated container definition.
*/
protected function share( string $id, $concrete = null ) : DefinitionInterface {
return $this->add( $id, $concrete, true );
}
}
Fatal error: Uncaught Error: Class "Automattic\WooCommerce\Internal\DependencyManagement\AbstractServiceProvider" not found in /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-content/plugins/woocommerce/src/Internal/DependencyManagement/ServiceProviders/AssignDefaultCategoryServiceProvider.php:14
Stack trace:
#0 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-content/plugins/jetpack/vendor/jetpack-autoloader/class-php-autoloader.php(90): require()
#1 [internal function]: Automattic\Jetpack\Autoloader\jpf11009ded9fc4592b6a05b61ce272b3c_jetpackā„13_3_1\al3_0_4\PHP_Autoloader::load_class()
#2 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-content/plugins/woocommerce/lib/packages/League/Container/ServiceProvider/ServiceProviderAggregate.php(30): class_exists()
#3 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-content/plugins/woocommerce/lib/packages/League/Container/Container.php(146): Automattic\WooCommerce\Vendor\League\Container\ServiceProvider\ServiceProviderAggregate->add()
#4 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-content/plugins/woocommerce/src/Container.php(103): Automattic\WooCommerce\Vendor\League\Container\Container->addServiceProvider()
#5 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-content/plugins/woocommerce/woocommerce.php(42): Automattic\WooCommerce\Container->__construct()
#6 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-settings.php(517): include_once('...')
#7 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-config.php(87): require_once('...')
#8 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-load.php(50): require_once('...')
#9 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-blog-header.php(13): require_once('...')
#10 /var/www/vhosts/casainfotech.co.nz/httpdocs/index.php(17): require('...')
#11 {main}
thrown in /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-content/plugins/woocommerce/src/Internal/DependencyManagement/ServiceProviders/AssignDefaultCategoryServiceProvider.php on line 14