From 6d5f6eb090a1ac394fae474fb7aa69ff046d05c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?imme=C3=ABmosol?= Date: Sat, 16 Oct 2021 10:36:02 +0200 Subject: [PATCH] Reaching phpstan level 6 in Composer\IO (#10166) --- src/Composer/IO/BaseIO.php | 4 +++- src/Composer/IO/BufferIO.php | 15 +++++++++++++++ src/Composer/IO/ConsoleIO.php | 17 ++++++++++++----- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/Composer/IO/BaseIO.php b/src/Composer/IO/BaseIO.php index 380902fa7..5fbb5f9d1 100644 --- a/src/Composer/IO/BaseIO.php +++ b/src/Composer/IO/BaseIO.php @@ -30,7 +30,7 @@ abstract class BaseIO implements IOInterface } /** - * {@inheritDoc} + * @return void */ public function resetAuthentications() { @@ -87,6 +87,8 @@ abstract class BaseIO implements IOInterface * @param string $repositoryName The unique name of repository * @param string $username The username * @param string $password The password + * + * @return void */ protected function checkAndSetAuthentication($repositoryName, $username, $password = null) { diff --git a/src/Composer/IO/BufferIO.php b/src/Composer/IO/BufferIO.php index e86500e2d..ea9864e91 100644 --- a/src/Composer/IO/BufferIO.php +++ b/src/Composer/IO/BufferIO.php @@ -46,6 +46,9 @@ class BufferIO extends ConsoleIO ))); } + /** + * @return string output + */ public function getOutput() { fseek($this->output->getStream(), 0); @@ -66,6 +69,13 @@ class BufferIO extends ConsoleIO return $output; } + /** + * @param string[] $inputs + * + * @see createStream + * + * @return void + */ public function setUserInputs(array $inputs) { if (!$this->input instanceof StreamableInputInterface) { @@ -76,6 +86,11 @@ class BufferIO extends ConsoleIO $this->input->setInteractive(true); } + /** + * @param string[] $inputs + * + * @return false|resource stream + */ private function createStream(array $inputs) { $stream = fopen('php://memory', 'r+'); diff --git a/src/Composer/IO/ConsoleIO.php b/src/Composer/IO/ConsoleIO.php index d6aa538c1..540f5412d 100644 --- a/src/Composer/IO/ConsoleIO.php +++ b/src/Composer/IO/ConsoleIO.php @@ -68,6 +68,8 @@ class ConsoleIO extends BaseIO /** * @param float $startTime + * + * @return void */ public function enableDebugging($startTime) { @@ -147,10 +149,13 @@ class ConsoleIO extends BaseIO } /** - * @param array|string $messages - * @param bool $newline - * @param bool $stderr - * @param int $verbosity + * @param string[]|string $messages + * @param bool $newline + * @param bool $stderr + * @param int $verbosity + * @param bool $raw + * + * @return void */ private function doWrite($messages, $newline, $stderr, $verbosity, $raw = false) { @@ -203,11 +208,13 @@ class ConsoleIO extends BaseIO } /** - * @param array|string $messages + * @param string[]|string $messages * @param bool $newline * @param int|null $size * @param bool $stderr * @param int $verbosity + * + * @return void */ private function doOverwrite($messages, $newline, $size, $stderr, $verbosity) {