Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cs #74

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
$this->request = $request;
}

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

/**
* {@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) {
throw new StreamException('Stream is detached');
Expand All @@ -84,9 +78,6 @@
fclose($this->socket);
}

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

/**
* {@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) {
throw new StreamException('Stream is detached');
Expand All @@ -125,10 +111,7 @@
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) {
throw new StreamException('Stream is detached');
Expand All @@ -137,61 +120,43 @@
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().
{
throw new StreamException('This stream is not seekable');
}

/**
* {@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 @@
return $read;
}

/**
* {@inheritdoc}
*/
public function getContents()
{
if ($this->isDetached || null === $this->socket) {
Expand All @@ -261,9 +223,6 @@
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();
Loading