@@ -18,11 +18,10 @@ trait RequestWriter
18
18
* Write a request to a socket.
19
19
*
20
20
* @param resource $socket
21
- * @param int $bufferSize
22
21
*
23
22
* @throws BrokenPipeException
24
23
*/
25
- protected function writeRequest ($ socket , RequestInterface $ request , $ bufferSize = 8192 )
24
+ protected function writeRequest ($ socket , RequestInterface $ request , int $ bufferSize = 8192 )
26
25
{
27
26
if (false === $ this ->fwrite ($ socket , $ this ->transformRequestHeadersToString ($ request ))) {
28
27
throw new BrokenPipeException ('Failed to send request, underlying socket not accessible, (BROKEN EPIPE) ' , $ request );
@@ -37,11 +36,10 @@ protected function writeRequest($socket, RequestInterface $request, $bufferSize
37
36
* Write Body of the request.
38
37
*
39
38
* @param resource $socket
40
- * @param int $bufferSize
41
39
*
42
40
* @throws BrokenPipeException
43
41
*/
44
- protected function writeBody ($ socket , RequestInterface $ request , $ bufferSize = 8192 )
42
+ protected function writeBody ($ socket , RequestInterface $ request , int $ bufferSize = 8192 )
45
43
{
46
44
$ body = $ request ->getBody ();
47
45
@@ -60,11 +58,8 @@ protected function writeBody($socket, RequestInterface $request, $bufferSize = 8
60
58
61
59
/**
62
60
* Produce the header of request as a string based on a PSR Request.
63
- *
64
- *
65
- * @return string
66
61
*/
67
- protected function transformRequestHeadersToString (RequestInterface $ request )
62
+ protected function transformRequestHeadersToString (RequestInterface $ request ): string
68
63
{
69
64
$ message = vsprintf ('%s %s HTTP/%s ' , [
70
65
strtoupper ($ request ->getMethod ()),
@@ -87,11 +82,10 @@ protected function transformRequestHeadersToString(RequestInterface $request)
87
82
* @see https://secure.phabricator.com/rPHU69490c53c9c2ef2002bc2dd4cecfe9a4b080b497
88
83
*
89
84
* @param resource $stream The stream resource
90
- * @param string $bytes Bytes written in the stream
91
85
*
92
86
* @return bool|int false if pipe is broken, number of bytes written otherwise
93
87
*/
94
- private function fwrite ($ stream , $ bytes )
88
+ private function fwrite ($ stream , string $ bytes )
95
89
{
96
90
if (!strlen ($ bytes )) {
97
91
return 0 ;
0 commit comments