Skip to content

Commit 4a69954

Browse files
authored
Merge pull request #74 from php-http/cs
fix cs
2 parents f6d07b9 + ef22c60 commit 4a69954

11 files changed

+11
-67
lines changed

.github/workflows/checks.yml

-10
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,3 @@ jobs:
1818
- name: Composer normalize
1919
uses: docker://ergebnis/composer-normalize-action
2020

21-
roave-bc-check:
22-
name: Roave BC Check
23-
runs-on: ubuntu-latest
24-
25-
steps:
26-
- name: Checkout code
27-
uses: actions/checkout@v4
28-
29-
- name: Roave BC Check
30-
uses: docker://nyholm/roave-bc-check-ga

src/Client.php

+4-7
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ public function __construct($config1 = [], $config2 = null, array $config = [])
5959
$this->config = $this->configure($config2 ?: $config);
6060
}
6161

62-
/**
63-
* {@inheritdoc}
64-
*/
6562
public function sendRequest(RequestInterface $request): ResponseInterface
6663
{
6764
$remote = $this->config['remote_socket'];
@@ -100,9 +97,9 @@ public function sendRequest(RequestInterface $request): ResponseInterface
10097
* @param string $remote Entrypoint for the connection
10198
* @param bool $useSsl Whether to use ssl or not
10299
*
103-
* @throws ConnectionException|SSLConnectionException When the connection fail
104-
*
105100
* @return resource Socket resource
101+
*
102+
* @throws ConnectionException|SSLConnectionException When the connection fail
106103
*/
107104
protected function createSocket(RequestInterface $request, string $remote, bool $useSsl)
108105
{
@@ -174,9 +171,9 @@ protected function configure(array $config = [])
174171
/**
175172
* Return remote socket from the request.
176173
*
177-
* @throws InvalidRequestException When no remote can be determined from the request
178-
*
179174
* @return string
175+
*
176+
* @throws InvalidRequestException When no remote can be determined from the request
180177
*/
181178
private function determineRemoteFromRequest(RequestInterface $request)
182179
{

src/Exception/NetworkException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class NetworkException extends \RuntimeException implements NetworkExceptionInte
1212
*/
1313
private $request;
1414

15-
public function __construct(string $message, RequestInterface $request, \Exception $previous = null)
15+
public function __construct(string $message, RequestInterface $request, ?\Exception $previous = null)
1616
{
1717
$this->request = $request;
1818

src/RequestWriter.php

+1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ private function fwrite($stream, string $bytes)
123123
// The write worked or failed explicitly. This value is fine to return.
124124
return $result;
125125
}
126+
126127
// We performed a 0-length write, were told that the stream was writable, and
127128
// then immediately performed another 0-length write. Conclude that the pipe
128129
// is broken and return `false`.

src/Stream.php

-41
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ public function __construct(RequestInterface $request, $socket, ?int $size = nul
6161
$this->request = $request;
6262
}
6363

64-
/**
65-
* {@inheritdoc}
66-
*/
6764
public function __toString()
6865
{
6966
try {
@@ -73,9 +70,6 @@ public function __toString()
7370
}
7471
}
7572

76-
/**
77-
* {@inheritdoc}
78-
*/
7973
public function close()
8074
{
8175
if ($this->isDetached || null === $this->socket) {
@@ -84,9 +78,6 @@ public function close()
8478
fclose($this->socket);
8579
}
8680

87-
/**
88-
* {@inheritdoc}
89-
*/
9081
public function detach()
9182
{
9283
if ($this->isDetached) {
@@ -100,18 +91,13 @@ public function detach()
10091
}
10192

10293
/**
103-
* {@inheritdoc}
104-
*
10594
* @return int<0, max>|null
10695
*/
10796
public function getSize()
10897
{
10998
return $this->size;
11099
}
111100

112-
/**
113-
* {@inheritdoc}
114-
*/
115101
public function tell()
116102
{
117103
if ($this->isDetached || null === $this->socket) {
@@ -125,9 +111,6 @@ public function tell()
125111
return $tell;
126112
}
127113

128-
/**
129-
* {@inheritdoc}
130-
*/
131114
public function eof()
132115
{
133116
if ($this->isDetached || null === $this->socket) {
@@ -137,17 +120,12 @@ public function eof()
137120
return feof($this->socket);
138121
}
139122

140-
/**
141-
* {@inheritdoc}
142-
*/
143123
public function isSeekable()
144124
{
145125
return false;
146126
}
147127

148128
/**
149-
* {@inheritdoc}
150-
*
151129
* @return void
152130
*/
153131
public function seek($offset, $whence = SEEK_SET)
@@ -156,42 +134,29 @@ public function seek($offset, $whence = SEEK_SET)
156134
}
157135

158136
/**
159-
* {@inheritdoc}
160-
*
161137
* @return void
162138
*/
163139
public function rewind()
164140
{
165141
throw new StreamException('This stream is not seekable');
166142
}
167143

168-
/**
169-
* {@inheritdoc}
170-
*/
171144
public function isWritable()
172145
{
173146
return false;
174147
}
175148

176-
/**
177-
* {@inheritdoc}
178-
*/
179149
public function write($string)
180150
{
181151
throw new StreamException('This stream is not writable');
182152
}
183153

184-
/**
185-
* {@inheritdoc}
186-
*/
187154
public function isReadable()
188155
{
189156
return true;
190157
}
191158

192159
/**
193-
* {@inheritdoc}
194-
*
195160
* @param int<0, max> $length
196161
*/
197162
public function read($length)
@@ -232,9 +197,6 @@ public function read($length)
232197
return $read;
233198
}
234199

235-
/**
236-
* {@inheritdoc}
237-
*/
238200
public function getContents()
239201
{
240202
if ($this->isDetached || null === $this->socket) {
@@ -261,9 +223,6 @@ public function getContents()
261223
return $contents;
262224
}
263225

264-
/**
265-
* {@inheritdoc}
266-
*/
267226
public function getMetadata($key = null)
268227
{
269228
if ($this->isDetached || null === $this->socket) {

tests/SocketHttpAdapterTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
class SocketHttpAdapterTest extends HttpClientTest
1010
{
11-
/**
12-
* {@inheritdoc}
13-
*/
1411
protected function createHttpAdapter(): ClientInterface
1512
{
1613
return new SocketHttpClient();

tests/server/tcp-bugous-server.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
$client = stream_socket_accept($socketServer);
77

88
fclose($client);
9-
\Http\Client\Socket\Tests\Semaphore::release();
9+
Http\Client\Socket\Tests\Semaphore::release();

tests/server/tcp-server.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
while (!@feof($client)) {
1717
@fread($client, 1000);
1818
}
19-
\Http\Client\Socket\Tests\Semaphore::release();
19+
Http\Client\Socket\Tests\Semaphore::release();

tests/server/tcp-ssl-server-client.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@
4646
while (!@feof($client)) {
4747
@fread($client, 1000);
4848
}
49-
\Http\Client\Socket\Tests\Semaphore::release();
49+
Http\Client\Socket\Tests\Semaphore::release();

tests/server/tcp-ssl-server.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
@fread($client, 1000);
3636
}
3737

38-
\Http\Client\Socket\Tests\Semaphore::release();
38+
Http\Client\Socket\Tests\Semaphore::release();

tests/server/unix-domain-server.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
}
2323

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

0 commit comments

Comments
 (0)