From ef22c600572f6a47fe207532de2ad0519106d1bb Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Mon, 4 Mar 2024 23:37:35 +0100 Subject: [PATCH] fix cs --- .github/workflows/checks.yml | 10 ------- src/Client.php | 11 +++---- src/Exception/NetworkException.php | 2 +- src/RequestWriter.php | 1 + src/Stream.php | 41 -------------------------- tests/SocketHttpAdapterTest.php | 3 -- tests/server/tcp-bugous-server.php | 2 +- tests/server/tcp-server.php | 2 +- tests/server/tcp-ssl-server-client.php | 2 +- tests/server/tcp-ssl-server.php | 2 +- tests/server/unix-domain-server.php | 2 +- 11 files changed, 11 insertions(+), 67 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 3b29468..8e3f23e 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -18,13 +18,3 @@ jobs: - name: Composer normalize uses: docker://ergebnis/composer-normalize-action - roave-bc-check: - name: Roave BC Check - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Roave BC Check - uses: docker://nyholm/roave-bc-check-ga diff --git a/src/Client.php b/src/Client.php index 6f57816..e6a96c0 100644 --- a/src/Client.php +++ b/src/Client.php @@ -59,9 +59,6 @@ public function __construct($config1 = [], $config2 = null, array $config = []) $this->config = $this->configure($config2 ?: $config); } - /** - * {@inheritdoc} - */ public function sendRequest(RequestInterface $request): ResponseInterface { $remote = $this->config['remote_socket']; @@ -100,9 +97,9 @@ public function sendRequest(RequestInterface $request): ResponseInterface * @param string $remote Entrypoint for the connection * @param bool $useSsl Whether to use ssl or not * - * @throws ConnectionException|SSLConnectionException When the connection fail - * * @return resource Socket resource + * + * @throws ConnectionException|SSLConnectionException When the connection fail */ protected function createSocket(RequestInterface $request, string $remote, bool $useSsl) { @@ -174,9 +171,9 @@ protected function configure(array $config = []) /** * Return remote socket from the request. * - * @throws InvalidRequestException When no remote can be determined from the request - * * @return string + * + * @throws InvalidRequestException When no remote can be determined from the request */ private function determineRemoteFromRequest(RequestInterface $request) { diff --git a/src/Exception/NetworkException.php b/src/Exception/NetworkException.php index 363af23..62d08a3 100644 --- a/src/Exception/NetworkException.php +++ b/src/Exception/NetworkException.php @@ -12,7 +12,7 @@ class NetworkException extends \RuntimeException implements NetworkExceptionInte */ private $request; - public function __construct(string $message, RequestInterface $request, \Exception $previous = null) + public function __construct(string $message, RequestInterface $request, ?\Exception $previous = null) { $this->request = $request; diff --git a/src/RequestWriter.php b/src/RequestWriter.php index 4e740b8..0ac0430 100644 --- a/src/RequestWriter.php +++ b/src/RequestWriter.php @@ -123,6 +123,7 @@ private function fwrite($stream, string $bytes) // The write worked or failed explicitly. This value is fine to return. return $result; } + // We performed a 0-length write, were told that the stream was writable, and // then immediately performed another 0-length write. Conclude that the pipe // is broken and return `false`. diff --git a/src/Stream.php b/src/Stream.php index c2475df..8d26ca0 100644 --- a/src/Stream.php +++ b/src/Stream.php @@ -61,9 +61,6 @@ public function __construct(RequestInterface $request, $socket, ?int $size = nul $this->request = $request; } - /** - * {@inheritdoc} - */ public function __toString() { try { @@ -73,9 +70,6 @@ public function __toString() } } - /** - * {@inheritdoc} - */ public function close() { if ($this->isDetached || null === $this->socket) { @@ -84,9 +78,6 @@ public function close() fclose($this->socket); } - /** - * {@inheritdoc} - */ public function detach() { if ($this->isDetached) { @@ -100,8 +91,6 @@ public function detach() } /** - * {@inheritdoc} - * * @return int<0, max>|null */ public function getSize() @@ -109,9 +98,6 @@ public function getSize() return $this->size; } - /** - * {@inheritdoc} - */ public function tell() { if ($this->isDetached || null === $this->socket) { @@ -125,9 +111,6 @@ public function tell() return $tell; } - /** - * {@inheritdoc} - */ public function eof() { if ($this->isDetached || null === $this->socket) { @@ -137,17 +120,12 @@ public function eof() return feof($this->socket); } - /** - * {@inheritdoc} - */ public function isSeekable() { return false; } /** - * {@inheritdoc} - * * @return void */ public function seek($offset, $whence = SEEK_SET) @@ -156,8 +134,6 @@ public function seek($offset, $whence = SEEK_SET) } /** - * {@inheritdoc} - * * @return void */ public function rewind() @@ -165,33 +141,22 @@ public function rewind() throw new StreamException('This stream is not seekable'); } - /** - * {@inheritdoc} - */ public function isWritable() { return false; } - /** - * {@inheritdoc} - */ public function write($string) { throw new StreamException('This stream is not writable'); } - /** - * {@inheritdoc} - */ public function isReadable() { return true; } /** - * {@inheritdoc} - * * @param int<0, max> $length */ public function read($length) @@ -232,9 +197,6 @@ public function read($length) return $read; } - /** - * {@inheritdoc} - */ public function getContents() { if ($this->isDetached || null === $this->socket) { @@ -261,9 +223,6 @@ public function getContents() return $contents; } - /** - * {@inheritdoc} - */ public function getMetadata($key = null) { if ($this->isDetached || null === $this->socket) { diff --git a/tests/SocketHttpAdapterTest.php b/tests/SocketHttpAdapterTest.php index f95b28e..72ed4bb 100644 --- a/tests/SocketHttpAdapterTest.php +++ b/tests/SocketHttpAdapterTest.php @@ -8,9 +8,6 @@ class SocketHttpAdapterTest extends HttpClientTest { - /** - * {@inheritdoc} - */ protected function createHttpAdapter(): ClientInterface { return new SocketHttpClient(); diff --git a/tests/server/tcp-bugous-server.php b/tests/server/tcp-bugous-server.php index d1a55ae..723a6eb 100644 --- a/tests/server/tcp-bugous-server.php +++ b/tests/server/tcp-bugous-server.php @@ -6,4 +6,4 @@ $client = stream_socket_accept($socketServer); fclose($client); -\Http\Client\Socket\Tests\Semaphore::release(); +Http\Client\Socket\Tests\Semaphore::release(); diff --git a/tests/server/tcp-server.php b/tests/server/tcp-server.php index 573da2a..4929984 100644 --- a/tests/server/tcp-server.php +++ b/tests/server/tcp-server.php @@ -16,4 +16,4 @@ while (!@feof($client)) { @fread($client, 1000); } -\Http\Client\Socket\Tests\Semaphore::release(); +Http\Client\Socket\Tests\Semaphore::release(); diff --git a/tests/server/tcp-ssl-server-client.php b/tests/server/tcp-ssl-server-client.php index 1e06cd3..6c7bf79 100644 --- a/tests/server/tcp-ssl-server-client.php +++ b/tests/server/tcp-ssl-server-client.php @@ -46,4 +46,4 @@ while (!@feof($client)) { @fread($client, 1000); } -\Http\Client\Socket\Tests\Semaphore::release(); +Http\Client\Socket\Tests\Semaphore::release(); diff --git a/tests/server/tcp-ssl-server.php b/tests/server/tcp-ssl-server.php index fb15359..7b63db1 100644 --- a/tests/server/tcp-ssl-server.php +++ b/tests/server/tcp-ssl-server.php @@ -35,4 +35,4 @@ @fread($client, 1000); } -\Http\Client\Socket\Tests\Semaphore::release(); +Http\Client\Socket\Tests\Semaphore::release(); diff --git a/tests/server/unix-domain-server.php b/tests/server/unix-domain-server.php index a051ffe..8a3368b 100644 --- a/tests/server/unix-domain-server.php +++ b/tests/server/unix-domain-server.php @@ -22,4 +22,4 @@ } unlink(__DIR__.'/server.sock'); -\Http\Client\Socket\Tests\Semaphore::release(); +Http\Client\Socket\Tests\Semaphore::release();