From c4c70030fffb2f93301b186ba74ef3b346d8a0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Glawaty?= Date: Thu, 23 Nov 2023 04:27:32 +0100 Subject: [PATCH] Fixed compiler extension for lowest composer dependencies (nette/application:^3.0.8) --- src/Bridge/Nette/DI/AmpClientExtension.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Bridge/Nette/DI/AmpClientExtension.php b/src/Bridge/Nette/DI/AmpClientExtension.php index 764a2af..e2f03b5 100644 --- a/src/Bridge/Nette/DI/AmpClientExtension.php +++ b/src/Bridge/Nette/DI/AmpClientExtension.php @@ -6,6 +6,7 @@ use Closure; use Nette\Bridges\ApplicationDI\LatteExtension; +use Nette\Bridges\ApplicationLatte\ILatteFactory; use Nette\Bridges\ApplicationLatte\LatteFactory; use Nette\DI\CompilerExtension; use Nette\DI\Definitions\Reference; @@ -43,6 +44,7 @@ use function array_filter; use function array_values; use function assert; +use function class_exists; use function count; use function is_string; use function sprintf; @@ -257,7 +259,10 @@ private function resolveRendererBridgeCreator(RendererConfig $config): Statement $rendererBridge = new Statement(LatteRendererBridge::class, [ 'latteFactory' => new Statement(ClosureLatteFactory::class, [ 'factory' => new Statement([Closure::class, 'fromCallable'], [ - [new Reference(LatteFactory::class), 'create'], + [ + new Reference(class_exists(LatteFactory::class) ? LatteFactory::class : ILatteFactory::class), + 'create', + ], ]), ]), ]);