@@ -61,8 +61,8 @@ public function __construct($body)
61
61
}
62
62
63
63
$ this ->stream = $ body ;
64
- $ meta = stream_get_meta_data ($ this ->stream );
65
- $ this ->seekable = $ meta ['seekable ' ] && 0 === fseek ($ this ->stream , 0 , \SEEK_CUR );
64
+ $ meta = \ stream_get_meta_data ($ this ->stream );
65
+ $ this ->seekable = $ meta ['seekable ' ] && 0 === \ fseek ($ this ->stream , 0 , \SEEK_CUR );
66
66
$ this ->readable = isset (self ::READ_WRITE_HASH ['read ' ][$ meta ['mode ' ]]);
67
67
$ this ->writable = isset (self ::READ_WRITE_HASH ['write ' ][$ meta ['mode ' ]]);
68
68
}
@@ -81,9 +81,9 @@ public static function create($body = ''): StreamInterface
81
81
}
82
82
83
83
if (\is_string ($ body )) {
84
- $ resource = fopen ('php://temp ' , 'rw+ ' );
85
- fwrite ($ resource , $ body );
86
- fseek ($ resource , 0 );
84
+ $ resource = \ fopen ('php://temp ' , 'rw+ ' );
85
+ \ fwrite ($ resource , $ body );
86
+ \ fseek ($ resource , 0 );
87
87
$ body = $ resource ;
88
88
}
89
89
@@ -118,13 +118,13 @@ public function __toString()
118
118
throw $ e ;
119
119
}
120
120
121
- if (\is_array ($ errorHandler = set_error_handler ('var_dump ' ))) {
121
+ if (\is_array ($ errorHandler = \ set_error_handler ('var_dump ' ))) {
122
122
$ errorHandler = $ errorHandler [0 ] ?? null ;
123
123
}
124
- restore_error_handler ();
124
+ \ restore_error_handler ();
125
125
126
126
if ($ e instanceof \Error || $ errorHandler instanceof SymfonyErrorHandler || $ errorHandler instanceof SymfonyLegacyErrorHandler) {
127
- return trigger_error ((string ) $ e , \E_USER_ERROR );
127
+ return \ trigger_error ((string ) $ e , \E_USER_ERROR );
128
128
}
129
129
130
130
return '' ;
@@ -135,7 +135,7 @@ public function close(): void
135
135
{
136
136
if (isset ($ this ->stream )) {
137
137
if (\is_resource ($ this ->stream )) {
138
- fclose ($ this ->stream );
138
+ \ fclose ($ this ->stream );
139
139
}
140
140
$ this ->detach ();
141
141
}
@@ -176,10 +176,10 @@ public function getSize(): ?int
176
176
177
177
// Clear the stat cache if the stream has a URI
178
178
if ($ uri = $ this ->getUri ()) {
179
- clearstatcache (true , $ uri );
179
+ \ clearstatcache (true , $ uri );
180
180
}
181
181
182
- $ stats = fstat ($ this ->stream );
182
+ $ stats = \ fstat ($ this ->stream );
183
183
if (isset ($ stats ['size ' ])) {
184
184
$ this ->size = $ stats ['size ' ];
185
185
@@ -195,16 +195,16 @@ public function tell(): int
195
195
throw new \RuntimeException ('Stream is detached ' );
196
196
}
197
197
198
- if (false === $ result = @ftell ($ this ->stream )) {
199
- throw new \RuntimeException ('Unable to determine stream position: ' . (error_get_last ()['message ' ] ?? '' ));
198
+ if (false === $ result = @\ ftell ($ this ->stream )) {
199
+ throw new \RuntimeException ('Unable to determine stream position: ' . (\ error_get_last ()['message ' ] ?? '' ));
200
200
}
201
201
202
202
return $ result ;
203
203
}
204
204
205
205
public function eof (): bool
206
206
{
207
- return !isset ($ this ->stream ) || feof ($ this ->stream );
207
+ return !isset ($ this ->stream ) || \ feof ($ this ->stream );
208
208
}
209
209
210
210
public function isSeekable (): bool
@@ -222,8 +222,8 @@ public function seek($offset, $whence = \SEEK_SET): void
222
222
throw new \RuntimeException ('Stream is not seekable ' );
223
223
}
224
224
225
- if (-1 === fseek ($ this ->stream , $ offset , $ whence )) {
226
- throw new \RuntimeException ('Unable to seek to stream position " ' . $ offset . '" with whence ' . var_export ($ whence , true ));
225
+ if (-1 === \ fseek ($ this ->stream , $ offset , $ whence )) {
226
+ throw new \RuntimeException ('Unable to seek to stream position " ' . $ offset . '" with whence ' . \ var_export ($ whence , true ));
227
227
}
228
228
}
229
229
@@ -250,8 +250,8 @@ public function write($string): int
250
250
// We can't know the size after writing anything
251
251
$ this ->size = null ;
252
252
253
- if (false === $ result = @fwrite ($ this ->stream , $ string )) {
254
- throw new \RuntimeException ('Unable to write to stream: ' . (error_get_last ()['message ' ] ?? '' ));
253
+ if (false === $ result = @\ fwrite ($ this ->stream , $ string )) {
254
+ throw new \RuntimeException ('Unable to write to stream: ' . (\ error_get_last ()['message ' ] ?? '' ));
255
255
}
256
256
257
257
return $ result ;
@@ -272,8 +272,8 @@ public function read($length): string
272
272
throw new \RuntimeException ('Cannot read from non-readable stream ' );
273
273
}
274
274
275
- if (false === $ result = @fread ($ this ->stream , $ length )) {
276
- throw new \RuntimeException ('Unable to read from stream: ' . (error_get_last ()['message ' ] ?? '' ));
275
+ if (false === $ result = @\ fread ($ this ->stream , $ length )) {
276
+ throw new \RuntimeException ('Unable to read from stream: ' . (\ error_get_last ()['message ' ] ?? '' ));
277
277
}
278
278
279
279
return $ result ;
@@ -285,8 +285,8 @@ public function getContents(): string
285
285
throw new \RuntimeException ('Stream is detached ' );
286
286
}
287
287
288
- if (false === $ contents = @stream_get_contents ($ this ->stream )) {
289
- throw new \RuntimeException ('Unable to read stream contents: ' . (error_get_last ()['message ' ] ?? '' ));
288
+ if (false === $ contents = @\ stream_get_contents ($ this ->stream )) {
289
+ throw new \RuntimeException ('Unable to read stream contents: ' . (\ error_get_last ()['message ' ] ?? '' ));
290
290
}
291
291
292
292
return $ contents ;
@@ -305,7 +305,7 @@ public function getMetadata($key = null)
305
305
return $ key ? null : [];
306
306
}
307
307
308
- $ meta = stream_get_meta_data ($ this ->stream );
308
+ $ meta = \ stream_get_meta_data ($ this ->stream );
309
309
310
310
if (null === $ key ) {
311
311
return $ meta ;
0 commit comments