@@ -18,11 +18,10 @@ trait RequestWriter
1818 * Write a request to a socket.
1919 *
2020 * @param resource $socket
21- * @param int $bufferSize
2221 *
2322 * @throws BrokenPipeException
2423 */
25- protected function writeRequest ($ socket , RequestInterface $ request , $ bufferSize = 8192 )
24+ protected function writeRequest ($ socket , RequestInterface $ request , int $ bufferSize = 8192 )
2625 {
2726 if (false === $ this ->fwrite ($ socket , $ this ->transformRequestHeadersToString ($ request ))) {
2827 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
3736 * Write Body of the request.
3837 *
3938 * @param resource $socket
40- * @param int $bufferSize
4139 *
4240 * @throws BrokenPipeException
4341 */
44- protected function writeBody ($ socket , RequestInterface $ request , $ bufferSize = 8192 )
42+ protected function writeBody ($ socket , RequestInterface $ request , int $ bufferSize = 8192 )
4543 {
4644 $ body = $ request ->getBody ();
4745
@@ -60,11 +58,8 @@ protected function writeBody($socket, RequestInterface $request, $bufferSize = 8
6058
6159 /**
6260 * Produce the header of request as a string based on a PSR Request.
63- *
64- *
65- * @return string
6661 */
67- protected function transformRequestHeadersToString (RequestInterface $ request )
62+ protected function transformRequestHeadersToString (RequestInterface $ request ): string
6863 {
6964 $ message = vsprintf ('%s %s HTTP/%s ' , [
7065 strtoupper ($ request ->getMethod ()),
@@ -87,11 +82,10 @@ protected function transformRequestHeadersToString(RequestInterface $request)
8782 * @see https://secure.phabricator.com/rPHU69490c53c9c2ef2002bc2dd4cecfe9a4b080b497
8883 *
8984 * @param resource $stream The stream resource
90- * @param string $bytes Bytes written in the stream
9185 *
9286 * @return bool|int false if pipe is broken, number of bytes written otherwise
9387 */
94- private function fwrite ($ stream , $ bytes )
88+ private function fwrite ($ stream , string $ bytes )
9589 {
9690 if (!strlen ($ bytes )) {
9791 return 0 ;
0 commit comments