@@ -44,7 +44,7 @@ final class DuplexResourceStream extends EventEmitter implements DuplexStreamInt
4444 * @param ?int $readChunkSize
4545 * @param ?WritableStreamInterface $buffer
4646 */
47- public function __construct ($ stream , ?LoopInterface $ loop = null , $ readChunkSize = null , ?WritableStreamInterface $ buffer = null )
47+ public function __construct ($ stream , ?LoopInterface $ loop = null , ? int $ readChunkSize = null , ?WritableStreamInterface $ buffer = null )
4848 {
4949 if (!\is_resource ($ stream ) || \get_resource_type ($ stream ) !== "stream " ) {
5050 throw new InvalidArgumentException ('First parameter must be a valid stream resource ' );
@@ -75,7 +75,7 @@ public function __construct($stream, ?LoopInterface $loop = null, $readChunkSize
7575
7676 $ this ->stream = $ stream ;
7777 $ this ->loop = $ loop ?: Loop::get ();
78- $ this ->bufferSize = ( $ readChunkSize === null ) ? 65536 : ( int ) $ readChunkSize ;
78+ $ this ->bufferSize = $ readChunkSize ?? 65536 ;
7979 $ this ->buffer = $ buffer ;
8080
8181 $ this ->buffer ->on ('error ' , function ($ error ) {
@@ -91,33 +91,33 @@ public function __construct($stream, ?LoopInterface $loop = null, $readChunkSize
9191 $ this ->resume ();
9292 }
9393
94- public function isReadable ()
94+ public function isReadable (): bool
9595 {
9696 return $ this ->readable ;
9797 }
9898
99- public function isWritable ()
99+ public function isWritable (): bool
100100 {
101101 return $ this ->writable ;
102102 }
103103
104- public function pause ()
104+ public function pause (): void
105105 {
106106 if ($ this ->listening ) {
107107 $ this ->loop ->removeReadStream ($ this ->stream );
108108 $ this ->listening = false ;
109109 }
110110 }
111111
112- public function resume ()
112+ public function resume (): void
113113 {
114114 if (!$ this ->listening && $ this ->readable ) {
115115 $ this ->loop ->addReadStream ($ this ->stream , [$ this , 'handleData ' ]);
116116 $ this ->listening = true ;
117117 }
118118 }
119119
120- public function write ($ data )
120+ public function write ($ data ): bool
121121 {
122122 if (!$ this ->writable ) {
123123 return false ;
@@ -126,7 +126,7 @@ public function write($data)
126126 return $ this ->buffer ->write ($ data );
127127 }
128128
129- public function close ()
129+ public function close (): void
130130 {
131131 if (!$ this ->writable && !$ this ->closing ) {
132132 return ;
@@ -147,7 +147,7 @@ public function close()
147147 }
148148 }
149149
150- public function end ($ data = null )
150+ public function end ($ data = null ): void
151151 {
152152 if (!$ this ->writable ) {
153153 return ;
@@ -162,7 +162,7 @@ public function end($data = null)
162162 $ this ->buffer ->end ($ data );
163163 }
164164
165- public function pipe (WritableStreamInterface $ dest , array $ options = [])
165+ public function pipe (WritableStreamInterface $ dest , array $ options = []): WritableStreamInterface
166166 {
167167 return Util::pipe ($ this , $ dest , $ options );
168168 }
0 commit comments