Allow module without Helper/HelperFactory (#40017)

This commit is contained in:
Tuan Pham Ngoc 2023-03-10 11:51:53 +07:00 committed by GitHub
parent 15dfdfb45f
commit e1c9bf3d9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -53,7 +53,7 @@ class Module implements ModuleInterface, HelperFactoryInterface
*
* @since 4.0.0
*/
public function __construct(ModuleDispatcherFactoryInterface $dispatcherFactory, HelperFactoryInterface $helperFactory)
public function __construct(ModuleDispatcherFactoryInterface $dispatcherFactory, ?HelperFactoryInterface $helperFactory)
{
$this->dispatcherFactory = $dispatcherFactory;
$this->helperFactory = $helperFactory;

View File

@ -42,7 +42,7 @@ class Module implements ServiceProviderInterface
function (Container $container) {
return new \Joomla\CMS\Extension\Module(
$container->get(ModuleDispatcherFactoryInterface::class),
$container->get(HelperFactoryInterface::class)
$container->has(HelperFactoryInterface::class) ? $container->get(HelperFactoryInterface::class) : null
);
}
);