diff --git a/src/Tempest/Console/src/Commands/TailDebugLogCommand.php b/src/Tempest/Console/src/Commands/TailDebugLogCommand.php index 1f545edde..39bad257e 100644 --- a/src/Tempest/Console/src/Commands/TailDebugLogCommand.php +++ b/src/Tempest/Console/src/Commands/TailDebugLogCommand.php @@ -8,6 +8,7 @@ use Tempest\Console\ConsoleCommand; use Tempest\Console\Highlight\VarExportLanguage\VarExportLanguage; use Tempest\Console\Output\TailReader; +use Tempest\Container\Tag; use Tempest\Highlight\Highlighter; use Tempest\Log\LogConfig; @@ -16,6 +17,7 @@ public function __construct( private Console $console, private LogConfig $logConfig, + #[Tag('console')] private Highlighter $highlighter, ) { } diff --git a/src/Tempest/Console/src/Commands/TailProjectLogCommand.php b/src/Tempest/Console/src/Commands/TailProjectLogCommand.php index d370280bb..f035a4145 100644 --- a/src/Tempest/Console/src/Commands/TailProjectLogCommand.php +++ b/src/Tempest/Console/src/Commands/TailProjectLogCommand.php @@ -8,6 +8,7 @@ use Tempest\Console\ConsoleCommand; use Tempest\Console\Highlight\LogLanguage\LogLanguage; use Tempest\Console\Output\TailReader; +use Tempest\Container\Tag; use Tempest\Highlight\Highlighter; use Tempest\Log\Channels\AppendLogChannel; use Tempest\Log\LogConfig; @@ -17,6 +18,7 @@ public function __construct( private Console $console, private LogConfig $logConfig, + #[Tag('console')] private Highlighter $highlighter, ) { } diff --git a/src/Tempest/Console/src/Commands/TailServerLogCommand.php b/src/Tempest/Console/src/Commands/TailServerLogCommand.php index b05f63367..2ef5d95ac 100644 --- a/src/Tempest/Console/src/Commands/TailServerLogCommand.php +++ b/src/Tempest/Console/src/Commands/TailServerLogCommand.php @@ -8,6 +8,7 @@ use Tempest\Console\ConsoleCommand; use Tempest\Console\Highlight\LogLanguage\LogLanguage; use Tempest\Console\Output\TailReader; +use Tempest\Container\Tag; use Tempest\Highlight\Highlighter; use Tempest\Log\LogConfig; @@ -16,6 +17,7 @@ public function __construct( private Console $console, private LogConfig $logConfig, + #[Tag('console')] private Highlighter $highlighter, ) { } diff --git a/src/Tempest/Console/src/Exceptions/ConsoleExceptionHandler.php b/src/Tempest/Console/src/Exceptions/ConsoleExceptionHandler.php index 08dfc377f..aae42991d 100644 --- a/src/Tempest/Console/src/Exceptions/ConsoleExceptionHandler.php +++ b/src/Tempest/Console/src/Exceptions/ConsoleExceptionHandler.php @@ -6,6 +6,7 @@ use Tempest\Console\Console; use Tempest\Console\Input\ConsoleArgumentBag; +use Tempest\Container\Tag; use Tempest\Core\ExceptionHandler; use Tempest\Highlight\Escape; use Tempest\Highlight\Highlighter; @@ -15,6 +16,7 @@ { public function __construct( private Console $console, + #[Tag('console')] private Highlighter $highlighter, private ConsoleArgumentBag $argumentBag, ) { diff --git a/src/Tempest/Console/src/GenericConsole.php b/src/Tempest/Console/src/GenericConsole.php index a158c83bc..4cbbec4fa 100644 --- a/src/Tempest/Console/src/GenericConsole.php +++ b/src/Tempest/Console/src/GenericConsole.php @@ -16,6 +16,7 @@ use Tempest\Console\Components\InteractiveComponentRenderer; use Tempest\Console\Exceptions\UnsupportedComponent; use Tempest\Console\Highlight\TempestConsoleLanguage\TempestConsoleLanguage; +use Tempest\Container\Tag; use Tempest\Highlight\Highlighter; final class GenericConsole implements Console @@ -29,6 +30,7 @@ final class GenericConsole implements Console public function __construct( private readonly OutputBuffer $output, private readonly InputBuffer $input, + #[Tag('console')] private readonly Highlighter $highlighter, private readonly ExecuteConsoleCommand $executeConsoleCommand, ) { diff --git a/src/Tempest/Console/src/Highlight/HighlighterInitializer.php b/src/Tempest/Console/src/Highlight/ConsoleHighlighterInitializer.php similarity index 76% rename from src/Tempest/Console/src/Highlight/HighlighterInitializer.php rename to src/Tempest/Console/src/Highlight/ConsoleHighlighterInitializer.php index 83655762f..e00a03207 100644 --- a/src/Tempest/Console/src/Highlight/HighlighterInitializer.php +++ b/src/Tempest/Console/src/Highlight/ConsoleHighlighterInitializer.php @@ -9,9 +9,9 @@ use Tempest\Container\Singleton; use Tempest\Highlight\Highlighter; -final readonly class HighlighterInitializer implements Initializer +final readonly class ConsoleHighlighterInitializer implements Initializer { - #[Singleton] + #[Singleton(tag: 'console')] public function initialize(Container $container): Highlighter { return new Highlighter(new TempestTerminalTheme()); diff --git a/src/Tempest/Console/src/Highlight/TempestConsoleLanguage/Injections/CommentInjection.php b/src/Tempest/Console/src/Highlight/TempestConsoleLanguage/Injections/CommentInjection.php index cf66b2797..a834d4d36 100644 --- a/src/Tempest/Console/src/Highlight/TempestConsoleLanguage/Injections/CommentInjection.php +++ b/src/Tempest/Console/src/Highlight/TempestConsoleLanguage/Injections/CommentInjection.php @@ -12,33 +12,6 @@ { use IsTagInjection; - // public function parse(string $content, Highlighter $highlighter): ParsedInjection - // { - // $lines = explode(PHP_EOL, $content); - // - // if (count($lines) > 1) { - // $comment = implode( - // PHP_EOL, - // [ - // '/*', - // ...array_map( - // fn (string $line) => " * {$line}", - // $lines, - // ), - // ' */', - // ], - // ); - // } else { - // $comment = '/* ' . $lines[0] . ' */'; - // } - // - // $comment = str_replace('/* *', '/*', $comment); - // - // return $comment; - // - // return $this->parseContent($content, $highlighter); - // } - public function getTag(): string { return 'comment'; diff --git a/src/Tempest/Console/src/Testing/ConsoleTester.php b/src/Tempest/Console/src/Testing/ConsoleTester.php index 2facc27a4..5b4b49be6 100644 --- a/src/Tempest/Console/src/Testing/ConsoleTester.php +++ b/src/Tempest/Console/src/Testing/ConsoleTester.php @@ -54,7 +54,7 @@ public function call(string|Closure|array $command): self $console = new GenericConsole( output: $memoryOutputBuffer, input: $memoryInputBuffer, - highlighter: $clone->container->get(Highlighter::class), + highlighter: $clone->container->get(Highlighter::class, 'console'), executeConsoleCommand: $clone->container->get(ExecuteConsoleCommand::class), ); diff --git a/src/Tempest/Support/src/ArrayHelper.php b/src/Tempest/Support/src/ArrayHelper.php index aacf974e5..6fa8da15e 100644 --- a/src/Tempest/Support/src/ArrayHelper.php +++ b/src/Tempest/Support/src/ArrayHelper.php @@ -19,8 +19,7 @@ final class ArrayHelper implements Iterator, ArrayAccess, Serializable, Countabl public function __construct( mixed $input = [], - ) - { + ) { if (is_array($input)) { $this->array = $input; } elseif ($input instanceof self) { diff --git a/src/Tempest/Support/src/InvalidMapWithKeysUsage.php b/src/Tempest/Support/src/InvalidMapWithKeysUsage.php index 0dc5e35f3..c8b8b31e4 100644 --- a/src/Tempest/Support/src/InvalidMapWithKeysUsage.php +++ b/src/Tempest/Support/src/InvalidMapWithKeysUsage.php @@ -1,5 +1,7 @@ yield $key => $value`'); } -} \ No newline at end of file +} diff --git a/src/Tempest/Support/tests/ArrayHelperTest.php b/src/Tempest/Support/tests/ArrayHelperTest.php index a23def89e..4eb4ffb4f 100644 --- a/src/Tempest/Support/tests/ArrayHelperTest.php +++ b/src/Tempest/Support/tests/ArrayHelperTest.php @@ -5,13 +5,12 @@ namespace Tempest\Support\Tests; use PHPUnit\Framework\TestCase; -use Tempest\Support\InvalidMapWithKeysUsage; use function Tempest\Support\arr; use Tempest\Support\ArrayHelper; +use Tempest\Support\InvalidMapWithKeysUsage; /** * @internal - * @small */ final class ArrayHelperTest extends TestCase {