Skip to content

Commit

Permalink
fix cs
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Mar 4, 2024
1 parent f6d07b9 commit ef22c60
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 67 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 4 additions & 7 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/NetworkException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions src/RequestWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
41 changes: 0 additions & 41 deletions src/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ public function __construct(RequestInterface $request, $socket, ?int $size = nul
$this->request = $request;
}

/**
* {@inheritdoc}
*/
public function __toString()
{
try {
Expand All @@ -73,9 +70,6 @@ public function __toString()
}
}

/**
* {@inheritdoc}
*/
public function close()

Check failure on line 73 in src/Stream.php

View workflow job for this annotation

GitHub Actions / PHPStan

Return type mixed of method Http\Client\Socket\Stream::close() is not covariant with return type void of method Psr\Http\Message\StreamInterface::close().
{
if ($this->isDetached || null === $this->socket) {
Expand All @@ -84,9 +78,6 @@ public function close()
fclose($this->socket);
}

/**
* {@inheritdoc}
*/
public function detach()
{
if ($this->isDetached) {
Expand All @@ -100,18 +91,13 @@ public function detach()
}

/**
* {@inheritdoc}
*
* @return int<0, max>|null
*/
public function getSize()

Check failure on line 96 in src/Stream.php

View workflow job for this annotation

GitHub Actions / PHPStan

Return type mixed of method Http\Client\Socket\Stream::getSize() is not covariant with return type int|null of method Psr\Http\Message\StreamInterface::getSize().
{
return $this->size;
}

/**
* {@inheritdoc}
*/
public function tell()

Check failure on line 101 in src/Stream.php

View workflow job for this annotation

GitHub Actions / PHPStan

Return type mixed of method Http\Client\Socket\Stream::tell() is not covariant with return type int of method Psr\Http\Message\StreamInterface::tell().
{
if ($this->isDetached || null === $this->socket) {
Expand All @@ -125,9 +111,6 @@ public function tell()
return $tell;
}

/**
* {@inheritdoc}
*/
public function eof()

Check failure on line 114 in src/Stream.php

View workflow job for this annotation

GitHub Actions / PHPStan

Return type mixed of method Http\Client\Socket\Stream::eof() is not covariant with return type bool of method Psr\Http\Message\StreamInterface::eof().
{
if ($this->isDetached || null === $this->socket) {
Expand All @@ -137,17 +120,12 @@ public function eof()
return feof($this->socket);
}

/**
* {@inheritdoc}
*/
public function isSeekable()

Check failure on line 123 in src/Stream.php

View workflow job for this annotation

GitHub Actions / PHPStan

Return type mixed of method Http\Client\Socket\Stream::isSeekable() is not covariant with return type bool of method Psr\Http\Message\StreamInterface::isSeekable().
{
return false;
}

/**
* {@inheritdoc}
*
* @return void
*/
public function seek($offset, $whence = SEEK_SET)

Check failure on line 131 in src/Stream.php

View workflow job for this annotation

GitHub Actions / PHPStan

Return type mixed of method Http\Client\Socket\Stream::seek() is not covariant with return type void of method Psr\Http\Message\StreamInterface::seek().
Expand All @@ -156,42 +134,29 @@ public function seek($offset, $whence = SEEK_SET)
}

/**
* {@inheritdoc}
*
* @return void
*/
public function rewind()

Check failure on line 139 in src/Stream.php

View workflow job for this annotation

GitHub Actions / PHPStan

Return type mixed of method Http\Client\Socket\Stream::rewind() is not covariant with return type void of method Psr\Http\Message\StreamInterface::rewind().
{
throw new StreamException('This stream is not seekable');
}

/**
* {@inheritdoc}
*/
public function isWritable()

Check failure on line 144 in src/Stream.php

View workflow job for this annotation

GitHub Actions / PHPStan

Return type mixed of method Http\Client\Socket\Stream::isWritable() is not covariant with return type bool of method Psr\Http\Message\StreamInterface::isWritable().
{
return false;
}

/**
* {@inheritdoc}
*/
public function write($string)

Check failure on line 149 in src/Stream.php

View workflow job for this annotation

GitHub Actions / PHPStan

Return type mixed of method Http\Client\Socket\Stream::write() is not covariant with return type int of method Psr\Http\Message\StreamInterface::write().
{
throw new StreamException('This stream is not writable');
}

/**
* {@inheritdoc}
*/
public function isReadable()
{
return true;
}

/**
* {@inheritdoc}
*
* @param int<0, max> $length
*/
public function read($length)
Expand Down Expand Up @@ -232,9 +197,6 @@ public function read($length)
return $read;
}

/**
* {@inheritdoc}
*/
public function getContents()
{
if ($this->isDetached || null === $this->socket) {
Expand All @@ -261,9 +223,6 @@ public function getContents()
return $contents;
}

/**
* {@inheritdoc}
*/
public function getMetadata($key = null)
{
if ($this->isDetached || null === $this->socket) {
Expand Down
3 changes: 0 additions & 3 deletions tests/SocketHttpAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

class SocketHttpAdapterTest extends HttpClientTest
{
/**
* {@inheritdoc}
*/
protected function createHttpAdapter(): ClientInterface
{
return new SocketHttpClient();
Expand Down
2 changes: 1 addition & 1 deletion tests/server/tcp-bugous-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
$client = stream_socket_accept($socketServer);

fclose($client);
\Http\Client\Socket\Tests\Semaphore::release();
Http\Client\Socket\Tests\Semaphore::release();
2 changes: 1 addition & 1 deletion tests/server/tcp-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
while (!@feof($client)) {
@fread($client, 1000);
}
\Http\Client\Socket\Tests\Semaphore::release();
Http\Client\Socket\Tests\Semaphore::release();
2 changes: 1 addition & 1 deletion tests/server/tcp-ssl-server-client.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@
while (!@feof($client)) {
@fread($client, 1000);
}
\Http\Client\Socket\Tests\Semaphore::release();
Http\Client\Socket\Tests\Semaphore::release();
2 changes: 1 addition & 1 deletion tests/server/tcp-ssl-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
@fread($client, 1000);
}

\Http\Client\Socket\Tests\Semaphore::release();
Http\Client\Socket\Tests\Semaphore::release();
2 changes: 1 addition & 1 deletion tests/server/unix-domain-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
}

unlink(__DIR__.'/server.sock');
\Http\Client\Socket\Tests\Semaphore::release();
Http\Client\Socket\Tests\Semaphore::release();

0 comments on commit ef22c60

Please sign in to comment.