for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
namespace AlecRabbit\Spinner\Core\Adapters;
use AlecRabbit\Spinner\Core\Contracts\OutputInterface;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\StreamOutput;
use function AlecRabbit\typeOf;
/**
* Class SymfonyOutputAdapter
*
* @codeCoverageIgnore
*/
class SymfonyOutputAdapter implements OutputInterface
{
/** @var StreamOutput */
protected $output;
public function __construct(ConsoleOutput $output)
$streamOutput = $output->getErrorOutput();
if ($streamOutput instanceof StreamOutput) {
$streamOutput
Symfony\Component\Console\Output\StreamOutput
$this->output = $streamOutput;
} else {
// @codeCoverageIgnoreStart
throw new \RuntimeException(
'Should never happen. $streamOutput is of wrong type: [' .
StreamOutput::class . '] expected , ['
. typeOf($streamOutput) . '] given.'
);
// @codeCoverageIgnoreEnd
}
/** {@inheritDoc} */
public function write($messages, $newline = false, $options = 0): void
$this->output->write($messages, $newline, $options);
* @return resource
public function getStream()
return $this->output->getStream();