Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Mar 28, 2022
1 parent aa51295 commit 9fdd12f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/Console/src/Bootloader/ConsoleBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ public function addUpdateSequence(

private function sequence(
string $target,
string|callable $sequence,
string|array|callable $sequence,
string $header,
string $footer,
array $options
): Append {
return new Append(
$target,
null,
\is_callable($sequence)
\is_array($sequence) || \is_callable($sequence)
? new CallableSequence($sequence, $header, $footer)
: new CommandSequence($sequence, $options, $header, $footer)
);
Expand Down
9 changes: 6 additions & 3 deletions src/Console/src/Sequence/CallableSequence.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@
*/
final class CallableSequence extends AbstractSequence
{
/** @var callable */
/** @var string|callable|array<class-string, string> */
private readonly mixed $function;

/**
* @param string|callable|array<class-string, string> $function
*/
public function __construct(
callable $function,
string|array|callable $function,
string $header = '',
string $footer = ''
) {
Expand All @@ -28,7 +31,7 @@ public function __construct(
public function execute(ContainerInterface $container, OutputInterface $output): void
{
$function = $this->function;
if (\is_string($function) && \strpos($function, ':') !== false) {
if (\is_string($function) && \str_contains($function, ':')) {
$function = \explode(':', \str_replace('::', ':', $function));
}

Expand Down
22 changes: 11 additions & 11 deletions src/Console/tests/ConfigureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,21 @@ public function testConfigure(): void
$actual = $core->run('configure')->getOutput()->fetch();

$expected = <<<'text'
Configuring project:
Configuring project:
Test Command
Hello World - 0
hello
Good!
Test Command
Hello World - 0
hello
Good!
OK
OK
OK2
exception
OK
OK
OK2
exception
All done!
All done!

text;
text;

$this->assertSame(
\str_replace("\r", '', $expected),
Expand Down

0 comments on commit 9fdd12f

Please sign in to comment.