From f0efaee49042036243727e8b71df82c20900327f Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 16 Dec 2023 02:30:06 +0100 Subject: [PATCH] pre-print --- config/config.php | 6 ++++++ src/Printer/PhpParserPhpConfigPrinter.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/config/config.php b/config/config.php index e69a855..297a95b 100644 --- a/config/config.php +++ b/config/config.php @@ -9,6 +9,7 @@ use Symfony\Component\Yaml\Parser; use Symplify\PhpConfigPrinter\Contract\CaseConverterInterface; use Symplify\PhpConfigPrinter\Contract\Converter\ServiceOptionsKeyYamlToPhpFactoryInterface; +use Symplify\PhpConfigPrinter\Contract\NodeVisitor\PrePrintNodeVisitorInterface; use Symplify\PhpConfigPrinter\Contract\RoutingCaseConverterInterface; use Symplify\PhpConfigPrinter\NodeFactory\ContainerConfiguratorReturnClosureFactory; use Symplify\PhpConfigPrinter\NodeFactory\RoutingConfiguratorReturnClosureFactory; @@ -29,6 +30,8 @@ __DIR__ . '/../src/CaseConverter' )->tag(CaseConverterInterface::class); + // \Symplify\PhpConfigPrinter\Contract\NodeVisitor\PrePrintNodeVisitorInterface + $services->load( 'Symplify\\PhpConfigPrinter\\RoutingCaseConverter\\', __DIR__ . '/../src/RoutingCaseConverter' @@ -49,6 +52,9 @@ $services->set(\Symplify\PhpConfigPrinter\NodeFactory\Service\ServiceOptionNodeFactory::class) ->arg('$serviceOptionKeyYamlToPhpFactories', tagged_iterator(ServiceOptionsKeyYamlToPhpFactoryInterface::class)); + $services->set(\Symplify\PhpConfigPrinter\Printer\PhpParserPhpConfigPrinter::class) + ->arg('$prePrintNodeVisitors', tagged_iterator(PrePrintNodeVisitorInterface::class)); + $services->set(NodeFinder::class); $services->set(Parser::class); $services->set(BuilderFactory::class); diff --git a/src/Printer/PhpParserPhpConfigPrinter.php b/src/Printer/PhpParserPhpConfigPrinter.php index 5df11a0..d341006 100644 --- a/src/Printer/PhpParserPhpConfigPrinter.php +++ b/src/Printer/PhpParserPhpConfigPrinter.php @@ -56,7 +56,7 @@ final class PhpParserPhpConfigPrinter extends Standard public function __construct( private readonly ImportFullyQualifiedNamesNodeTraverser $importFullyQualifiedNamesNodeTraverser, private readonly EmptyLineNodeDecorator $emptyLineNodeDecorator, - private readonly array $prePrintNodeVisitors + private readonly iterable $prePrintNodeVisitors ) { parent::__construct(); }