diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index f1b7a74..ab45b70 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -23,6 +23,7 @@ new PhpCsFixerCodingStandard()->applyTo($config, [ 'heredoc_indentation' => false, + 'native_constant_invocation' => false, ]); return $config; diff --git a/composer.json b/composer.json index 33311a3..e8ca03b 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,6 @@ "php": "^8.4", "ext-bcmath": "*", "ext-filter": "*", - "amphp/byte-stream": "^2.1", "nette/php-generator": "4.2.1", "thesis/package-version": "0.1.2", "thesis/protobuf": "^0.1.6", @@ -32,9 +31,6 @@ "phpunit/phpunit": "^12.4", "symfony/var-dumper": "^8.0" }, - "conflict": { - "revolt/event-loop": "<0.2.5" - }, "autoload": { "psr-4": { "Thesis\\Protoc\\": "src/" diff --git a/src/Io/ReadStreamInput.php b/src/Io/ReadStreamInput.php index 372492c..95ce132 100644 --- a/src/Io/ReadStreamInput.php +++ b/src/Io/ReadStreamInput.php @@ -4,7 +4,6 @@ namespace Thesis\Protoc\Io; -use Amp\ByteStream; use Thesis\Protoc\Exception\InvalidInput; use Thesis\Protoc\ReadInput; @@ -16,10 +15,12 @@ #[\Override] public function read(): string { - try { - return ByteStream\buffer(ByteStream\getStdin()); - } catch (ByteStream\BufferException $e) { - throw new InvalidInput($e->getMessage(), $e->getCode(), $e); + $contents = stream_get_contents(\STDIN); + + if ($contents === false) { + throw new InvalidInput('Failed to read from STDIN'); } + + return $contents; } } diff --git a/src/Io/WriteStreamOutput.php b/src/Io/WriteStreamOutput.php index 2a0cb89..272d00c 100644 --- a/src/Io/WriteStreamOutput.php +++ b/src/Io/WriteStreamOutput.php @@ -4,7 +4,6 @@ namespace Thesis\Protoc\Io; -use Amp\ByteStream; use Thesis\Protoc\WriteOutput; /** @@ -15,6 +14,6 @@ #[\Override] public function write(string $buffer): void { - ByteStream\getStdout()->write($buffer); + fwrite(\STDOUT, $buffer); } }