Skip to content

Commit

Permalink
chore: deprecate direct usage of output methods
Browse files Browse the repository at this point in the history
  • Loading branch information
imdhemy committed Apr 8, 2024
1 parent 7884a44 commit 610f46d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return $result;
}

throw new RuntimeException(
'Either the `handle()` method must be implemented or the `execute()` method must be overridden.'
);
throw new RuntimeException('Either the `handle()` method must be implemented or the `execute()` method must be overridden.');
}

public function getInput(): InputInterface
Expand Down
9 changes: 9 additions & 0 deletions src/IO/IOTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@

/**
* @mixin Output
*
* @internal
*/
trait IOTrait
{
public function __call(string $name, array $arguments): mixed
{
if (method_exists($this->output, $name)) {
trigger_deprecation(
'symblaze/console',
'1.2.0',
sprintf('The method "%s" is deprecated, use the output method directly.', $name)
);
}

return $this->output->$name(...$arguments);
}

Expand Down
4 changes: 3 additions & 1 deletion src/IO/Output.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
/**
* The Symblaze output helper class.
*
* @internal - This class is for internal use only
* @internal - This class is for internal use only
*
* @psalm-api - Provides a custom output helper for the console.
*/
class Output extends SymfonyStyle
{
Expand Down

0 comments on commit 610f46d

Please sign in to comment.