@@ -61,7 +61,7 @@ public function __construct(RequestInterface $request, $socket, ?int $size = nul
61
61
$ this ->request = $ request ;
62
62
}
63
63
64
- public function __toString ()
64
+ public function __toString (): string
65
65
{
66
66
try {
67
67
return $ this ->getContents ();
@@ -70,7 +70,7 @@ public function __toString()
70
70
}
71
71
}
72
72
73
- public function close ()
73
+ public function close (): void
74
74
{
75
75
if ($ this ->isDetached || null === $ this ->socket ) {
76
76
throw new StreamException ('Stream is detached ' );
@@ -93,12 +93,12 @@ public function detach()
93
93
/**
94
94
* @return int<0, max>|null
95
95
*/
96
- public function getSize ()
96
+ public function getSize (): ? int
97
97
{
98
98
return $ this ->size ;
99
99
}
100
100
101
- public function tell ()
101
+ public function tell (): int
102
102
{
103
103
if ($ this ->isDetached || null === $ this ->socket ) {
104
104
throw new StreamException ('Stream is detached ' );
@@ -111,7 +111,7 @@ public function tell()
111
111
return $ tell ;
112
112
}
113
113
114
- public function eof ()
114
+ public function eof (): bool
115
115
{
116
116
if ($ this ->isDetached || null === $ this ->socket ) {
117
117
throw new StreamException ('Stream is detached ' );
@@ -120,46 +120,40 @@ public function eof()
120
120
return feof ($ this ->socket );
121
121
}
122
122
123
- public function isSeekable ()
123
+ public function isSeekable (): bool
124
124
{
125
125
return false ;
126
126
}
127
127
128
- /**
129
- * @return void
130
- */
131
- public function seek ($ offset , $ whence = SEEK_SET )
128
+ public function seek ($ offset , $ whence = SEEK_SET ): void
132
129
{
133
130
throw new StreamException ('This stream is not seekable ' );
134
131
}
135
132
136
- /**
137
- * @return void
138
- */
139
- public function rewind ()
133
+ public function rewind (): void
140
134
{
141
135
throw new StreamException ('This stream is not seekable ' );
142
136
}
143
137
144
- public function isWritable ()
138
+ public function isWritable (): bool
145
139
{
146
140
return false ;
147
141
}
148
142
149
- public function write ($ string )
143
+ public function write ($ string ): int
150
144
{
151
145
throw new StreamException ('This stream is not writable ' );
152
146
}
153
147
154
- public function isReadable ()
148
+ public function isReadable (): bool
155
149
{
156
150
return true ;
157
151
}
158
152
159
153
/**
160
154
* @param int<0, max> $length
161
155
*/
162
- public function read ($ length )
156
+ public function read ($ length ): string
163
157
{
164
158
if ($ this ->isDetached || null === $ this ->socket ) {
165
159
throw new StreamException ('Stream is detached ' );
@@ -197,7 +191,7 @@ public function read($length)
197
191
return $ read ;
198
192
}
199
193
200
- public function getContents ()
194
+ public function getContents (): string
201
195
{
202
196
if ($ this ->isDetached || null === $ this ->socket ) {
203
197
throw new StreamException ('Stream is detached ' );
0 commit comments