@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | */ |
16 | 16 | function opcache_compile_file(string $file): void |
17 | 17 | { |
18 | - error_clear_last(); |
|
19 | - $result = \opcache_compile_file($file); |
|
20 | - if ($result === false) { |
|
21 | - throw OpcacheException::createFromPhpError(); |
|
22 | - } |
|
18 | + error_clear_last(); |
|
19 | + $result = \opcache_compile_file($file); |
|
20 | + if ($result === false) { |
|
21 | + throw OpcacheException::createFromPhpError(); |
|
22 | + } |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | */ |
34 | 34 | function opcache_get_status(bool $get_scripts = true): array |
35 | 35 | { |
36 | - error_clear_last(); |
|
37 | - $result = \opcache_get_status($get_scripts); |
|
38 | - if ($result === false) { |
|
39 | - throw OpcacheException::createFromPhpError(); |
|
40 | - } |
|
41 | - return $result; |
|
36 | + error_clear_last(); |
|
37 | + $result = \opcache_get_status($get_scripts); |
|
38 | + if ($result === false) { |
|
39 | + throw OpcacheException::createFromPhpError(); |
|
40 | + } |
|
41 | + return $result; |
|
42 | 42 | } |
@@ -14,11 +14,11 @@ discard block |
||
14 | 14 | */ |
15 | 15 | function chdir(string $directory): void |
16 | 16 | { |
17 | - error_clear_last(); |
|
18 | - $result = \chdir($directory); |
|
19 | - if ($result === false) { |
|
20 | - throw DirException::createFromPhpError(); |
|
21 | - } |
|
17 | + error_clear_last(); |
|
18 | + $result = \chdir($directory); |
|
19 | + if ($result === false) { |
|
20 | + throw DirException::createFromPhpError(); |
|
21 | + } |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function chroot(string $directory): void |
39 | 39 | { |
40 | - error_clear_last(); |
|
41 | - $result = \chroot($directory); |
|
42 | - if ($result === false) { |
|
43 | - throw DirException::createFromPhpError(); |
|
44 | - } |
|
40 | + error_clear_last(); |
|
41 | + $result = \chroot($directory); |
|
42 | + if ($result === false) { |
|
43 | + throw DirException::createFromPhpError(); |
|
44 | + } |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | */ |
61 | 61 | function getcwd(): string |
62 | 62 | { |
63 | - error_clear_last(); |
|
64 | - $result = \getcwd(); |
|
65 | - if ($result === false) { |
|
66 | - throw DirException::createFromPhpError(); |
|
67 | - } |
|
68 | - return $result; |
|
63 | + error_clear_last(); |
|
64 | + $result = \getcwd(); |
|
65 | + if ($result === false) { |
|
66 | + throw DirException::createFromPhpError(); |
|
67 | + } |
|
68 | + return $result; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | */ |
85 | 85 | function opendir(string $path, $context = null) |
86 | 86 | { |
87 | - error_clear_last(); |
|
88 | - if ($context !== null) { |
|
89 | - $result = \opendir($path, $context); |
|
90 | - } else { |
|
91 | - $result = \opendir($path); |
|
92 | - } |
|
93 | - if ($result === false) { |
|
94 | - throw DirException::createFromPhpError(); |
|
95 | - } |
|
96 | - return $result; |
|
87 | + error_clear_last(); |
|
88 | + if ($context !== null) { |
|
89 | + $result = \opendir($path, $context); |
|
90 | + } else { |
|
91 | + $result = \opendir($path); |
|
92 | + } |
|
93 | + if ($result === false) { |
|
94 | + throw DirException::createFromPhpError(); |
|
95 | + } |
|
96 | + return $result; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | */ |
112 | 112 | function rewinddir($dir_handle = null): void |
113 | 113 | { |
114 | - error_clear_last(); |
|
115 | - if ($dir_handle !== null) { |
|
116 | - $result = \rewinddir($dir_handle); |
|
117 | - } else { |
|
118 | - $result = \rewinddir(); |
|
119 | - } |
|
120 | - if ($result === false) { |
|
121 | - throw DirException::createFromPhpError(); |
|
122 | - } |
|
114 | + error_clear_last(); |
|
115 | + if ($dir_handle !== null) { |
|
116 | + $result = \rewinddir($dir_handle); |
|
117 | + } else { |
|
118 | + $result = \rewinddir(); |
|
119 | + } |
|
120 | + if ($result === false) { |
|
121 | + throw DirException::createFromPhpError(); |
|
122 | + } |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | */ |
145 | 145 | function scandir(string $directory, int $sorting_order = SCANDIR_SORT_ASCENDING, $context = null): array |
146 | 146 | { |
147 | - error_clear_last(); |
|
148 | - if ($context !== null) { |
|
149 | - $result = \scandir($directory, $sorting_order, $context); |
|
150 | - } else { |
|
151 | - $result = \scandir($directory, $sorting_order); |
|
152 | - } |
|
153 | - if ($result === false) { |
|
154 | - throw DirException::createFromPhpError(); |
|
155 | - } |
|
156 | - return $result; |
|
147 | + error_clear_last(); |
|
148 | + if ($context !== null) { |
|
149 | + $result = \scandir($directory, $sorting_order, $context); |
|
150 | + } else { |
|
151 | + $result = \scandir($directory, $sorting_order); |
|
152 | + } |
|
153 | + if ($result === false) { |
|
154 | + throw DirException::createFromPhpError(); |
|
155 | + } |
|
156 | + return $result; |
|
157 | 157 | } |
@@ -14,9 +14,9 @@ |
||
14 | 14 | */ |
15 | 15 | function fastcgi_finish_request(): void |
16 | 16 | { |
17 | - error_clear_last(); |
|
18 | - $result = \fastcgi_finish_request(); |
|
19 | - if ($result === false) { |
|
20 | - throw FpmException::createFromPhpError(); |
|
21 | - } |
|
17 | + error_clear_last(); |
|
18 | + $result = \fastcgi_finish_request(); |
|
19 | + if ($result === false) { |
|
20 | + throw FpmException::createFromPhpError(); |
|
21 | + } |
|
22 | 22 | } |
@@ -52,9 +52,9 @@ |
||
52 | 52 | */ |
53 | 53 | function settype(&$var, string $type): void |
54 | 54 | { |
55 | - error_clear_last(); |
|
56 | - $result = \settype($var, $type); |
|
57 | - if ($result === false) { |
|
58 | - throw VarException::createFromPhpError(); |
|
59 | - } |
|
55 | + error_clear_last(); |
|
56 | + $result = \settype($var, $type); |
|
57 | + if ($result === false) { |
|
58 | + throw VarException::createFromPhpError(); |
|
59 | + } |
|
60 | 60 | } |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | */ |
19 | 19 | function chgrp(string $filename, $group): void |
20 | 20 | { |
21 | - error_clear_last(); |
|
22 | - $result = \chgrp($filename, $group); |
|
23 | - if ($result === false) { |
|
24 | - throw FilesystemException::createFromPhpError(); |
|
25 | - } |
|
21 | + error_clear_last(); |
|
22 | + $result = \chgrp($filename, $group); |
|
23 | + if ($result === false) { |
|
24 | + throw FilesystemException::createFromPhpError(); |
|
25 | + } |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | */ |
61 | 61 | function chmod(string $filename, int $mode): void |
62 | 62 | { |
63 | - error_clear_last(); |
|
64 | - $result = \chmod($filename, $mode); |
|
65 | - if ($result === false) { |
|
66 | - throw FilesystemException::createFromPhpError(); |
|
67 | - } |
|
63 | + error_clear_last(); |
|
64 | + $result = \chmod($filename, $mode); |
|
65 | + if ($result === false) { |
|
66 | + throw FilesystemException::createFromPhpError(); |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | */ |
81 | 81 | function chown(string $filename, $user): void |
82 | 82 | { |
83 | - error_clear_last(); |
|
84 | - $result = \chown($filename, $user); |
|
85 | - if ($result === false) { |
|
86 | - throw FilesystemException::createFromPhpError(); |
|
87 | - } |
|
83 | + error_clear_last(); |
|
84 | + $result = \chown($filename, $user); |
|
85 | + if ($result === false) { |
|
86 | + throw FilesystemException::createFromPhpError(); |
|
87 | + } |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -107,15 +107,15 @@ discard block |
||
107 | 107 | */ |
108 | 108 | function copy(string $source, string $dest, $context = null): void |
109 | 109 | { |
110 | - error_clear_last(); |
|
111 | - if ($context !== null) { |
|
112 | - $result = \copy($source, $dest, $context); |
|
113 | - } else { |
|
114 | - $result = \copy($source, $dest); |
|
115 | - } |
|
116 | - if ($result === false) { |
|
117 | - throw FilesystemException::createFromPhpError(); |
|
118 | - } |
|
110 | + error_clear_last(); |
|
111 | + if ($context !== null) { |
|
112 | + $result = \copy($source, $dest, $context); |
|
113 | + } else { |
|
114 | + $result = \copy($source, $dest); |
|
115 | + } |
|
116 | + if ($result === false) { |
|
117 | + throw FilesystemException::createFromPhpError(); |
|
118 | + } |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | */ |
136 | 136 | function disk_free_space(string $directory): float |
137 | 137 | { |
138 | - error_clear_last(); |
|
139 | - $result = \disk_free_space($directory); |
|
140 | - if ($result === false) { |
|
141 | - throw FilesystemException::createFromPhpError(); |
|
142 | - } |
|
143 | - return $result; |
|
138 | + error_clear_last(); |
|
139 | + $result = \disk_free_space($directory); |
|
140 | + if ($result === false) { |
|
141 | + throw FilesystemException::createFromPhpError(); |
|
142 | + } |
|
143 | + return $result; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
@@ -155,12 +155,12 @@ discard block |
||
155 | 155 | */ |
156 | 156 | function disk_total_space(string $directory): float |
157 | 157 | { |
158 | - error_clear_last(); |
|
159 | - $result = \disk_total_space($directory); |
|
160 | - if ($result === false) { |
|
161 | - throw FilesystemException::createFromPhpError(); |
|
162 | - } |
|
163 | - return $result; |
|
158 | + error_clear_last(); |
|
159 | + $result = \disk_total_space($directory); |
|
160 | + if ($result === false) { |
|
161 | + throw FilesystemException::createFromPhpError(); |
|
162 | + } |
|
163 | + return $result; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | */ |
175 | 175 | function fclose($handle): void |
176 | 176 | { |
177 | - error_clear_last(); |
|
178 | - $result = \fclose($handle); |
|
179 | - if ($result === false) { |
|
180 | - throw FilesystemException::createFromPhpError(); |
|
181 | - } |
|
177 | + error_clear_last(); |
|
178 | + $result = \fclose($handle); |
|
179 | + if ($result === false) { |
|
180 | + throw FilesystemException::createFromPhpError(); |
|
181 | + } |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | */ |
196 | 196 | function fflush($handle): void |
197 | 197 | { |
198 | - error_clear_last(); |
|
199 | - $result = \fflush($handle); |
|
200 | - if ($result === false) { |
|
201 | - throw FilesystemException::createFromPhpError(); |
|
202 | - } |
|
198 | + error_clear_last(); |
|
199 | + $result = \fflush($handle); |
|
200 | + if ($result === false) { |
|
201 | + throw FilesystemException::createFromPhpError(); |
|
202 | + } |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | |
@@ -239,20 +239,20 @@ discard block |
||
239 | 239 | */ |
240 | 240 | function file_get_contents(string $filename, bool $use_include_path = false, $context = null, int $offset = 0, int $maxlen = null): string |
241 | 241 | { |
242 | - error_clear_last(); |
|
243 | - if ($maxlen !== null) { |
|
244 | - $result = \file_get_contents($filename, $use_include_path, $context, $offset, $maxlen); |
|
245 | - } elseif ($offset !== 0) { |
|
246 | - $result = \file_get_contents($filename, $use_include_path, $context, $offset); |
|
247 | - } elseif ($context !== null) { |
|
248 | - $result = \file_get_contents($filename, $use_include_path, $context); |
|
249 | - } else { |
|
250 | - $result = \file_get_contents($filename, $use_include_path); |
|
251 | - } |
|
252 | - if ($result === false) { |
|
253 | - throw FilesystemException::createFromPhpError(); |
|
254 | - } |
|
255 | - return $result; |
|
242 | + error_clear_last(); |
|
243 | + if ($maxlen !== null) { |
|
244 | + $result = \file_get_contents($filename, $use_include_path, $context, $offset, $maxlen); |
|
245 | + } elseif ($offset !== 0) { |
|
246 | + $result = \file_get_contents($filename, $use_include_path, $context, $offset); |
|
247 | + } elseif ($context !== null) { |
|
248 | + $result = \file_get_contents($filename, $use_include_path, $context); |
|
249 | + } else { |
|
250 | + $result = \file_get_contents($filename, $use_include_path); |
|
251 | + } |
|
252 | + if ($result === false) { |
|
253 | + throw FilesystemException::createFromPhpError(); |
|
254 | + } |
|
255 | + return $result; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -332,16 +332,16 @@ discard block |
||
332 | 332 | */ |
333 | 333 | function file_put_contents(string $filename, $data, int $flags = 0, $context = null): int |
334 | 334 | { |
335 | - error_clear_last(); |
|
336 | - if ($context !== null) { |
|
337 | - $result = \file_put_contents($filename, $data, $flags, $context); |
|
338 | - } else { |
|
339 | - $result = \file_put_contents($filename, $data, $flags); |
|
340 | - } |
|
341 | - if ($result === false) { |
|
342 | - throw FilesystemException::createFromPhpError(); |
|
343 | - } |
|
344 | - return $result; |
|
335 | + error_clear_last(); |
|
336 | + if ($context !== null) { |
|
337 | + $result = \file_put_contents($filename, $data, $flags, $context); |
|
338 | + } else { |
|
339 | + $result = \file_put_contents($filename, $data, $flags); |
|
340 | + } |
|
341 | + if ($result === false) { |
|
342 | + throw FilesystemException::createFromPhpError(); |
|
343 | + } |
|
344 | + return $result; |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
@@ -392,16 +392,16 @@ discard block |
||
392 | 392 | */ |
393 | 393 | function file(string $filename, int $flags = 0, $context = null): array |
394 | 394 | { |
395 | - error_clear_last(); |
|
396 | - if ($context !== null) { |
|
397 | - $result = \file($filename, $flags, $context); |
|
398 | - } else { |
|
399 | - $result = \file($filename, $flags); |
|
400 | - } |
|
401 | - if ($result === false) { |
|
402 | - throw FilesystemException::createFromPhpError(); |
|
403 | - } |
|
404 | - return $result; |
|
395 | + error_clear_last(); |
|
396 | + if ($context !== null) { |
|
397 | + $result = \file($filename, $flags, $context); |
|
398 | + } else { |
|
399 | + $result = \file($filename, $flags); |
|
400 | + } |
|
401 | + if ($result === false) { |
|
402 | + throw FilesystemException::createFromPhpError(); |
|
403 | + } |
|
404 | + return $result; |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | |
@@ -416,12 +416,12 @@ discard block |
||
416 | 416 | */ |
417 | 417 | function fileatime(string $filename): int |
418 | 418 | { |
419 | - error_clear_last(); |
|
420 | - $result = \fileatime($filename); |
|
421 | - if ($result === false) { |
|
422 | - throw FilesystemException::createFromPhpError(); |
|
423 | - } |
|
424 | - return $result; |
|
419 | + error_clear_last(); |
|
420 | + $result = \fileatime($filename); |
|
421 | + if ($result === false) { |
|
422 | + throw FilesystemException::createFromPhpError(); |
|
423 | + } |
|
424 | + return $result; |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | |
@@ -436,12 +436,12 @@ discard block |
||
436 | 436 | */ |
437 | 437 | function filectime(string $filename): int |
438 | 438 | { |
439 | - error_clear_last(); |
|
440 | - $result = \filectime($filename); |
|
441 | - if ($result === false) { |
|
442 | - throw FilesystemException::createFromPhpError(); |
|
443 | - } |
|
444 | - return $result; |
|
439 | + error_clear_last(); |
|
440 | + $result = \filectime($filename); |
|
441 | + if ($result === false) { |
|
442 | + throw FilesystemException::createFromPhpError(); |
|
443 | + } |
|
444 | + return $result; |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | |
@@ -455,12 +455,12 @@ discard block |
||
455 | 455 | */ |
456 | 456 | function fileinode(string $filename): int |
457 | 457 | { |
458 | - error_clear_last(); |
|
459 | - $result = \fileinode($filename); |
|
460 | - if ($result === false) { |
|
461 | - throw FilesystemException::createFromPhpError(); |
|
462 | - } |
|
463 | - return $result; |
|
458 | + error_clear_last(); |
|
459 | + $result = \fileinode($filename); |
|
460 | + if ($result === false) { |
|
461 | + throw FilesystemException::createFromPhpError(); |
|
462 | + } |
|
463 | + return $result; |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | |
@@ -477,12 +477,12 @@ discard block |
||
477 | 477 | */ |
478 | 478 | function filemtime(string $filename): int |
479 | 479 | { |
480 | - error_clear_last(); |
|
481 | - $result = \filemtime($filename); |
|
482 | - if ($result === false) { |
|
483 | - throw FilesystemException::createFromPhpError(); |
|
484 | - } |
|
485 | - return $result; |
|
480 | + error_clear_last(); |
|
481 | + $result = \filemtime($filename); |
|
482 | + if ($result === false) { |
|
483 | + throw FilesystemException::createFromPhpError(); |
|
484 | + } |
|
485 | + return $result; |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | |
@@ -498,12 +498,12 @@ discard block |
||
498 | 498 | */ |
499 | 499 | function fileowner(string $filename): int |
500 | 500 | { |
501 | - error_clear_last(); |
|
502 | - $result = \fileowner($filename); |
|
503 | - if ($result === false) { |
|
504 | - throw FilesystemException::createFromPhpError(); |
|
505 | - } |
|
506 | - return $result; |
|
501 | + error_clear_last(); |
|
502 | + $result = \fileowner($filename); |
|
503 | + if ($result === false) { |
|
504 | + throw FilesystemException::createFromPhpError(); |
|
505 | + } |
|
506 | + return $result; |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | |
@@ -518,12 +518,12 @@ discard block |
||
518 | 518 | */ |
519 | 519 | function filesize(string $filename): int |
520 | 520 | { |
521 | - error_clear_last(); |
|
522 | - $result = \filesize($filename); |
|
523 | - if ($result === false) { |
|
524 | - throw FilesystemException::createFromPhpError(); |
|
525 | - } |
|
526 | - return $result; |
|
521 | + error_clear_last(); |
|
522 | + $result = \filesize($filename); |
|
523 | + if ($result === false) { |
|
524 | + throw FilesystemException::createFromPhpError(); |
|
525 | + } |
|
526 | + return $result; |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | |
@@ -572,11 +572,11 @@ discard block |
||
572 | 572 | */ |
573 | 573 | function flock($handle, int $operation, ?int &$wouldblock = null): void |
574 | 574 | { |
575 | - error_clear_last(); |
|
576 | - $result = \flock($handle, $operation, $wouldblock); |
|
577 | - if ($result === false) { |
|
578 | - throw FilesystemException::createFromPhpError(); |
|
579 | - } |
|
575 | + error_clear_last(); |
|
576 | + $result = \flock($handle, $operation, $wouldblock); |
|
577 | + if ($result === false) { |
|
578 | + throw FilesystemException::createFromPhpError(); |
|
579 | + } |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | |
@@ -781,16 +781,16 @@ discard block |
||
781 | 781 | */ |
782 | 782 | function fopen(string $filename, string $mode, bool $use_include_path = false, $context = null) |
783 | 783 | { |
784 | - error_clear_last(); |
|
785 | - if ($context !== null) { |
|
786 | - $result = \fopen($filename, $mode, $use_include_path, $context); |
|
787 | - } else { |
|
788 | - $result = \fopen($filename, $mode, $use_include_path); |
|
789 | - } |
|
790 | - if ($result === false) { |
|
791 | - throw FilesystemException::createFromPhpError(); |
|
792 | - } |
|
793 | - return $result; |
|
784 | + error_clear_last(); |
|
785 | + if ($context !== null) { |
|
786 | + $result = \fopen($filename, $mode, $use_include_path, $context); |
|
787 | + } else { |
|
788 | + $result = \fopen($filename, $mode, $use_include_path); |
|
789 | + } |
|
790 | + if ($result === false) { |
|
791 | + throw FilesystemException::createFromPhpError(); |
|
792 | + } |
|
793 | + return $result; |
|
794 | 794 | } |
795 | 795 | |
796 | 796 | |
@@ -817,12 +817,12 @@ discard block |
||
817 | 817 | */ |
818 | 818 | function fputcsv($handle, array $fields, string $delimiter = ",", string $enclosure = '"', string $escape_char = "\\"): int |
819 | 819 | { |
820 | - error_clear_last(); |
|
821 | - $result = \fputcsv($handle, $fields, $delimiter, $enclosure, $escape_char); |
|
822 | - if ($result === false) { |
|
823 | - throw FilesystemException::createFromPhpError(); |
|
824 | - } |
|
825 | - return $result; |
|
820 | + error_clear_last(); |
|
821 | + $result = \fputcsv($handle, $fields, $delimiter, $enclosure, $escape_char); |
|
822 | + if ($result === false) { |
|
823 | + throw FilesystemException::createFromPhpError(); |
|
824 | + } |
|
825 | + return $result; |
|
826 | 826 | } |
827 | 827 | |
828 | 828 | |
@@ -867,12 +867,12 @@ discard block |
||
867 | 867 | */ |
868 | 868 | function fread($handle, int $length): string |
869 | 869 | { |
870 | - error_clear_last(); |
|
871 | - $result = \fread($handle, $length); |
|
872 | - if ($result === false) { |
|
873 | - throw FilesystemException::createFromPhpError(); |
|
874 | - } |
|
875 | - return $result; |
|
870 | + error_clear_last(); |
|
871 | + $result = \fread($handle, $length); |
|
872 | + if ($result === false) { |
|
873 | + throw FilesystemException::createFromPhpError(); |
|
874 | + } |
|
875 | + return $result; |
|
876 | 876 | } |
877 | 877 | |
878 | 878 | |
@@ -895,11 +895,11 @@ discard block |
||
895 | 895 | */ |
896 | 896 | function ftruncate($handle, int $size): void |
897 | 897 | { |
898 | - error_clear_last(); |
|
899 | - $result = \ftruncate($handle, $size); |
|
900 | - if ($result === false) { |
|
901 | - throw FilesystemException::createFromPhpError(); |
|
902 | - } |
|
898 | + error_clear_last(); |
|
899 | + $result = \ftruncate($handle, $size); |
|
900 | + if ($result === false) { |
|
901 | + throw FilesystemException::createFromPhpError(); |
|
902 | + } |
|
903 | 903 | } |
904 | 904 | |
905 | 905 | |
@@ -924,16 +924,16 @@ discard block |
||
924 | 924 | */ |
925 | 925 | function fwrite($handle, string $string, int $length = null): int |
926 | 926 | { |
927 | - error_clear_last(); |
|
928 | - if ($length !== null) { |
|
929 | - $result = \fwrite($handle, $string, $length); |
|
930 | - } else { |
|
931 | - $result = \fwrite($handle, $string); |
|
932 | - } |
|
933 | - if ($result === false) { |
|
934 | - throw FilesystemException::createFromPhpError(); |
|
935 | - } |
|
936 | - return $result; |
|
927 | + error_clear_last(); |
|
928 | + if ($length !== null) { |
|
929 | + $result = \fwrite($handle, $string, $length); |
|
930 | + } else { |
|
931 | + $result = \fwrite($handle, $string); |
|
932 | + } |
|
933 | + if ($result === false) { |
|
934 | + throw FilesystemException::createFromPhpError(); |
|
935 | + } |
|
936 | + return $result; |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | |
@@ -1023,12 +1023,12 @@ discard block |
||
1023 | 1023 | */ |
1024 | 1024 | function glob(string $pattern, int $flags = 0): array |
1025 | 1025 | { |
1026 | - error_clear_last(); |
|
1027 | - $result = \glob($pattern, $flags); |
|
1028 | - if ($result === false) { |
|
1029 | - throw FilesystemException::createFromPhpError(); |
|
1030 | - } |
|
1031 | - return $result; |
|
1026 | + error_clear_last(); |
|
1027 | + $result = \glob($pattern, $flags); |
|
1028 | + if ($result === false) { |
|
1029 | + throw FilesystemException::createFromPhpError(); |
|
1030 | + } |
|
1031 | + return $result; |
|
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | |
@@ -1047,11 +1047,11 @@ discard block |
||
1047 | 1047 | */ |
1048 | 1048 | function lchgrp(string $filename, $group): void |
1049 | 1049 | { |
1050 | - error_clear_last(); |
|
1051 | - $result = \lchgrp($filename, $group); |
|
1052 | - if ($result === false) { |
|
1053 | - throw FilesystemException::createFromPhpError(); |
|
1054 | - } |
|
1050 | + error_clear_last(); |
|
1051 | + $result = \lchgrp($filename, $group); |
|
1052 | + if ($result === false) { |
|
1053 | + throw FilesystemException::createFromPhpError(); |
|
1054 | + } |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | |
@@ -1068,11 +1068,11 @@ discard block |
||
1068 | 1068 | */ |
1069 | 1069 | function lchown(string $filename, $user): void |
1070 | 1070 | { |
1071 | - error_clear_last(); |
|
1072 | - $result = \lchown($filename, $user); |
|
1073 | - if ($result === false) { |
|
1074 | - throw FilesystemException::createFromPhpError(); |
|
1075 | - } |
|
1071 | + error_clear_last(); |
|
1072 | + $result = \lchown($filename, $user); |
|
1073 | + if ($result === false) { |
|
1074 | + throw FilesystemException::createFromPhpError(); |
|
1075 | + } |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | |
@@ -1086,11 +1086,11 @@ discard block |
||
1086 | 1086 | */ |
1087 | 1087 | function link(string $target, string $link): void |
1088 | 1088 | { |
1089 | - error_clear_last(); |
|
1090 | - $result = \link($target, $link); |
|
1091 | - if ($result === false) { |
|
1092 | - throw FilesystemException::createFromPhpError(); |
|
1093 | - } |
|
1089 | + error_clear_last(); |
|
1090 | + $result = \link($target, $link); |
|
1091 | + if ($result === false) { |
|
1092 | + throw FilesystemException::createFromPhpError(); |
|
1093 | + } |
|
1094 | 1094 | } |
1095 | 1095 | |
1096 | 1096 | |
@@ -1116,15 +1116,15 @@ discard block |
||
1116 | 1116 | */ |
1117 | 1117 | function mkdir(string $pathname, int $mode = 0777, bool $recursive = false, $context = null): void |
1118 | 1118 | { |
1119 | - error_clear_last(); |
|
1120 | - if ($context !== null) { |
|
1121 | - $result = \mkdir($pathname, $mode, $recursive, $context); |
|
1122 | - } else { |
|
1123 | - $result = \mkdir($pathname, $mode, $recursive); |
|
1124 | - } |
|
1125 | - if ($result === false) { |
|
1126 | - throw FilesystemException::createFromPhpError(); |
|
1127 | - } |
|
1119 | + error_clear_last(); |
|
1120 | + if ($context !== null) { |
|
1121 | + $result = \mkdir($pathname, $mode, $recursive, $context); |
|
1122 | + } else { |
|
1123 | + $result = \mkdir($pathname, $mode, $recursive); |
|
1124 | + } |
|
1125 | + if ($result === false) { |
|
1126 | + throw FilesystemException::createFromPhpError(); |
|
1127 | + } |
|
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | |
@@ -1159,12 +1159,12 @@ discard block |
||
1159 | 1159 | */ |
1160 | 1160 | function parse_ini_file(string $filename, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array |
1161 | 1161 | { |
1162 | - error_clear_last(); |
|
1163 | - $result = \parse_ini_file($filename, $process_sections, $scanner_mode); |
|
1164 | - if ($result === false) { |
|
1165 | - throw FilesystemException::createFromPhpError(); |
|
1166 | - } |
|
1167 | - return $result; |
|
1162 | + error_clear_last(); |
|
1163 | + $result = \parse_ini_file($filename, $process_sections, $scanner_mode); |
|
1164 | + if ($result === false) { |
|
1165 | + throw FilesystemException::createFromPhpError(); |
|
1166 | + } |
|
1167 | + return $result; |
|
1168 | 1168 | } |
1169 | 1169 | |
1170 | 1170 | |
@@ -1196,12 +1196,12 @@ discard block |
||
1196 | 1196 | */ |
1197 | 1197 | function parse_ini_string(string $ini, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array |
1198 | 1198 | { |
1199 | - error_clear_last(); |
|
1200 | - $result = \parse_ini_string($ini, $process_sections, $scanner_mode); |
|
1201 | - if ($result === false) { |
|
1202 | - throw FilesystemException::createFromPhpError(); |
|
1203 | - } |
|
1204 | - return $result; |
|
1199 | + error_clear_last(); |
|
1200 | + $result = \parse_ini_string($ini, $process_sections, $scanner_mode); |
|
1201 | + if ($result === false) { |
|
1202 | + throw FilesystemException::createFromPhpError(); |
|
1203 | + } |
|
1204 | + return $result; |
|
1205 | 1205 | } |
1206 | 1206 | |
1207 | 1207 | |
@@ -1218,16 +1218,16 @@ discard block |
||
1218 | 1218 | */ |
1219 | 1219 | function readfile(string $filename, bool $use_include_path = false, $context = null): int |
1220 | 1220 | { |
1221 | - error_clear_last(); |
|
1222 | - if ($context !== null) { |
|
1223 | - $result = \readfile($filename, $use_include_path, $context); |
|
1224 | - } else { |
|
1225 | - $result = \readfile($filename, $use_include_path); |
|
1226 | - } |
|
1227 | - if ($result === false) { |
|
1228 | - throw FilesystemException::createFromPhpError(); |
|
1229 | - } |
|
1230 | - return $result; |
|
1221 | + error_clear_last(); |
|
1222 | + if ($context !== null) { |
|
1223 | + $result = \readfile($filename, $use_include_path, $context); |
|
1224 | + } else { |
|
1225 | + $result = \readfile($filename, $use_include_path); |
|
1226 | + } |
|
1227 | + if ($result === false) { |
|
1228 | + throw FilesystemException::createFromPhpError(); |
|
1229 | + } |
|
1230 | + return $result; |
|
1231 | 1231 | } |
1232 | 1232 | |
1233 | 1233 | |
@@ -1241,12 +1241,12 @@ discard block |
||
1241 | 1241 | */ |
1242 | 1242 | function readlink(string $path): string |
1243 | 1243 | { |
1244 | - error_clear_last(); |
|
1245 | - $result = \readlink($path); |
|
1246 | - if ($result === false) { |
|
1247 | - throw FilesystemException::createFromPhpError(); |
|
1248 | - } |
|
1249 | - return $result; |
|
1244 | + error_clear_last(); |
|
1245 | + $result = \readlink($path); |
|
1246 | + if ($result === false) { |
|
1247 | + throw FilesystemException::createFromPhpError(); |
|
1248 | + } |
|
1249 | + return $result; |
|
1250 | 1250 | } |
1251 | 1251 | |
1252 | 1252 | |
@@ -1277,12 +1277,12 @@ discard block |
||
1277 | 1277 | */ |
1278 | 1278 | function realpath(string $path): string |
1279 | 1279 | { |
1280 | - error_clear_last(); |
|
1281 | - $result = \realpath($path); |
|
1282 | - if ($result === false) { |
|
1283 | - throw FilesystemException::createFromPhpError(); |
|
1284 | - } |
|
1285 | - return $result; |
|
1280 | + error_clear_last(); |
|
1281 | + $result = \realpath($path); |
|
1282 | + if ($result === false) { |
|
1283 | + throw FilesystemException::createFromPhpError(); |
|
1284 | + } |
|
1285 | + return $result; |
|
1286 | 1286 | } |
1287 | 1287 | |
1288 | 1288 | |
@@ -1306,15 +1306,15 @@ discard block |
||
1306 | 1306 | */ |
1307 | 1307 | function rename(string $oldname, string $newname, $context = null): void |
1308 | 1308 | { |
1309 | - error_clear_last(); |
|
1310 | - if ($context !== null) { |
|
1311 | - $result = \rename($oldname, $newname, $context); |
|
1312 | - } else { |
|
1313 | - $result = \rename($oldname, $newname); |
|
1314 | - } |
|
1315 | - if ($result === false) { |
|
1316 | - throw FilesystemException::createFromPhpError(); |
|
1317 | - } |
|
1309 | + error_clear_last(); |
|
1310 | + if ($context !== null) { |
|
1311 | + $result = \rename($oldname, $newname, $context); |
|
1312 | + } else { |
|
1313 | + $result = \rename($oldname, $newname); |
|
1314 | + } |
|
1315 | + if ($result === false) { |
|
1316 | + throw FilesystemException::createFromPhpError(); |
|
1317 | + } |
|
1318 | 1318 | } |
1319 | 1319 | |
1320 | 1320 | |
@@ -1329,11 +1329,11 @@ discard block |
||
1329 | 1329 | */ |
1330 | 1330 | function rewind($handle): void |
1331 | 1331 | { |
1332 | - error_clear_last(); |
|
1333 | - $result = \rewind($handle); |
|
1334 | - if ($result === false) { |
|
1335 | - throw FilesystemException::createFromPhpError(); |
|
1336 | - } |
|
1332 | + error_clear_last(); |
|
1333 | + $result = \rewind($handle); |
|
1334 | + if ($result === false) { |
|
1335 | + throw FilesystemException::createFromPhpError(); |
|
1336 | + } |
|
1337 | 1337 | } |
1338 | 1338 | |
1339 | 1339 | |
@@ -1349,15 +1349,15 @@ discard block |
||
1349 | 1349 | */ |
1350 | 1350 | function rmdir(string $dirname, $context = null): void |
1351 | 1351 | { |
1352 | - error_clear_last(); |
|
1353 | - if ($context !== null) { |
|
1354 | - $result = \rmdir($dirname, $context); |
|
1355 | - } else { |
|
1356 | - $result = \rmdir($dirname); |
|
1357 | - } |
|
1358 | - if ($result === false) { |
|
1359 | - throw FilesystemException::createFromPhpError(); |
|
1360 | - } |
|
1352 | + error_clear_last(); |
|
1353 | + if ($context !== null) { |
|
1354 | + $result = \rmdir($dirname, $context); |
|
1355 | + } else { |
|
1356 | + $result = \rmdir($dirname); |
|
1357 | + } |
|
1358 | + if ($result === false) { |
|
1359 | + throw FilesystemException::createFromPhpError(); |
|
1360 | + } |
|
1361 | 1361 | } |
1362 | 1362 | |
1363 | 1363 | |
@@ -1373,11 +1373,11 @@ discard block |
||
1373 | 1373 | */ |
1374 | 1374 | function symlink(string $target, string $link): void |
1375 | 1375 | { |
1376 | - error_clear_last(); |
|
1377 | - $result = \symlink($target, $link); |
|
1378 | - if ($result === false) { |
|
1379 | - throw FilesystemException::createFromPhpError(); |
|
1380 | - } |
|
1376 | + error_clear_last(); |
|
1377 | + $result = \symlink($target, $link); |
|
1378 | + if ($result === false) { |
|
1379 | + throw FilesystemException::createFromPhpError(); |
|
1380 | + } |
|
1381 | 1381 | } |
1382 | 1382 | |
1383 | 1383 | |
@@ -1395,12 +1395,12 @@ discard block |
||
1395 | 1395 | */ |
1396 | 1396 | function tempnam(string $dir, string $prefix): string |
1397 | 1397 | { |
1398 | - error_clear_last(); |
|
1399 | - $result = \tempnam($dir, $prefix); |
|
1400 | - if ($result === false) { |
|
1401 | - throw FilesystemException::createFromPhpError(); |
|
1402 | - } |
|
1403 | - return $result; |
|
1398 | + error_clear_last(); |
|
1399 | + $result = \tempnam($dir, $prefix); |
|
1400 | + if ($result === false) { |
|
1401 | + throw FilesystemException::createFromPhpError(); |
|
1402 | + } |
|
1403 | + return $result; |
|
1404 | 1404 | } |
1405 | 1405 | |
1406 | 1406 | |
@@ -1420,12 +1420,12 @@ discard block |
||
1420 | 1420 | */ |
1421 | 1421 | function tmpfile() |
1422 | 1422 | { |
1423 | - error_clear_last(); |
|
1424 | - $result = \tmpfile(); |
|
1425 | - if ($result === false) { |
|
1426 | - throw FilesystemException::createFromPhpError(); |
|
1427 | - } |
|
1428 | - return $result; |
|
1423 | + error_clear_last(); |
|
1424 | + $result = \tmpfile(); |
|
1425 | + if ($result === false) { |
|
1426 | + throw FilesystemException::createFromPhpError(); |
|
1427 | + } |
|
1428 | + return $result; |
|
1429 | 1429 | } |
1430 | 1430 | |
1431 | 1431 | |
@@ -1450,17 +1450,17 @@ discard block |
||
1450 | 1450 | */ |
1451 | 1451 | function touch(string $filename, int $time = null, int $atime = null): void |
1452 | 1452 | { |
1453 | - error_clear_last(); |
|
1454 | - if ($atime !== null) { |
|
1455 | - $result = \touch($filename, $time, $atime); |
|
1456 | - } elseif ($time !== null) { |
|
1457 | - $result = \touch($filename, $time); |
|
1458 | - } else { |
|
1459 | - $result = \touch($filename); |
|
1460 | - } |
|
1461 | - if ($result === false) { |
|
1462 | - throw FilesystemException::createFromPhpError(); |
|
1463 | - } |
|
1453 | + error_clear_last(); |
|
1454 | + if ($atime !== null) { |
|
1455 | + $result = \touch($filename, $time, $atime); |
|
1456 | + } elseif ($time !== null) { |
|
1457 | + $result = \touch($filename, $time); |
|
1458 | + } else { |
|
1459 | + $result = \touch($filename); |
|
1460 | + } |
|
1461 | + if ($result === false) { |
|
1462 | + throw FilesystemException::createFromPhpError(); |
|
1463 | + } |
|
1464 | 1464 | } |
1465 | 1465 | |
1466 | 1466 | |
@@ -1476,13 +1476,13 @@ discard block |
||
1476 | 1476 | */ |
1477 | 1477 | function unlink(string $filename, $context = null): void |
1478 | 1478 | { |
1479 | - error_clear_last(); |
|
1480 | - if ($context !== null) { |
|
1481 | - $result = \unlink($filename, $context); |
|
1482 | - } else { |
|
1483 | - $result = \unlink($filename); |
|
1484 | - } |
|
1485 | - if ($result === false) { |
|
1486 | - throw FilesystemException::createFromPhpError(); |
|
1487 | - } |
|
1479 | + error_clear_last(); |
|
1480 | + if ($context !== null) { |
|
1481 | + $result = \unlink($filename, $context); |
|
1482 | + } else { |
|
1483 | + $result = \unlink($filename); |
|
1484 | + } |
|
1485 | + if ($result === false) { |
|
1486 | + throw FilesystemException::createFromPhpError(); |
|
1487 | + } |
|
1488 | 1488 | } |
@@ -68,15 +68,15 @@ |
||
68 | 68 | */ |
69 | 69 | function error_log(string $message, int $message_type = 0, string $destination = null, string $extra_headers = null): void |
70 | 70 | { |
71 | - error_clear_last(); |
|
72 | - if ($extra_headers !== null) { |
|
73 | - $result = \error_log($message, $message_type, $destination, $extra_headers); |
|
74 | - } elseif ($destination !== null) { |
|
75 | - $result = \error_log($message, $message_type, $destination); |
|
76 | - } else { |
|
77 | - $result = \error_log($message, $message_type); |
|
78 | - } |
|
79 | - if ($result === false) { |
|
80 | - throw ErrorfuncException::createFromPhpError(); |
|
81 | - } |
|
71 | + error_clear_last(); |
|
72 | + if ($extra_headers !== null) { |
|
73 | + $result = \error_log($message, $message_type, $destination, $extra_headers); |
|
74 | + } elseif ($destination !== null) { |
|
75 | + $result = \error_log($message, $message_type, $destination); |
|
76 | + } else { |
|
77 | + $result = \error_log($message, $message_type); |
|
78 | + } |
|
79 | + if ($result === false) { |
|
80 | + throw ErrorfuncException::createFromPhpError(); |
|
81 | + } |
|
82 | 82 | } |
@@ -3,9 +3,9 @@ |
||
3 | 3 | |
4 | 4 | class PsException extends \ErrorException implements SafeExceptionInterface |
5 | 5 | { |
6 | - public static function createFromPhpError(): self |
|
7 | - { |
|
8 | - $error = error_get_last(); |
|
9 | - return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1); |
|
10 | - } |
|
6 | + public static function createFromPhpError(): self |
|
7 | + { |
|
8 | + $error = error_get_last(); |
|
9 | + return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1); |
|
10 | + } |
|
11 | 11 | } |
@@ -3,9 +3,9 @@ |
||
3 | 3 | |
4 | 4 | class FtpException extends \ErrorException implements SafeExceptionInterface |
5 | 5 | { |
6 | - public static function createFromPhpError(): self |
|
7 | - { |
|
8 | - $error = error_get_last(); |
|
9 | - return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1); |
|
10 | - } |
|
6 | + public static function createFromPhpError(): self |
|
7 | + { |
|
8 | + $error = error_get_last(); |
|
9 | + return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1); |
|
10 | + } |
|
11 | 11 | } |
@@ -3,9 +3,9 @@ |
||
3 | 3 | |
4 | 4 | class SqlsrvException extends \ErrorException implements SafeExceptionInterface |
5 | 5 | { |
6 | - public static function createFromPhpError(): self |
|
7 | - { |
|
8 | - $error = error_get_last(); |
|
9 | - return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1); |
|
10 | - } |
|
6 | + public static function createFromPhpError(): self |
|
7 | + { |
|
8 | + $error = error_get_last(); |
|
9 | + return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1); |
|
10 | + } |
|
11 | 11 | } |