mirror of
https://github.com/danog/psalm.git
synced 2025-01-09 06:28:36 +01:00
36 lines
592 B
PHP
36 lines
592 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psalm\Internal\LanguageServer;
|
|
|
|
use Amp\ByteStream\ResourceOutputStream;
|
|
use Amp\Promise;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
class ProtocolStreamWriter implements ProtocolWriter
|
|
{
|
|
/**
|
|
* @var ResourceOutputStream
|
|
*/
|
|
private $output;
|
|
|
|
/**
|
|
* @param resource $output
|
|
*/
|
|
public function __construct($output)
|
|
{
|
|
$this->output = new ResourceOutputStream($output);
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function write(Message $msg): Promise
|
|
{
|
|
return $this->output->write((string)$msg);
|
|
}
|
|
}
|