@@ -13,11 +13,11 @@ |
||
13 | 13 | |
14 | 14 | use Evenement\EventEmitter; |
15 | 15 | |
16 | -require __DIR__.'/../vendor/autoload.php'; |
|
16 | +require __DIR__ . '/../vendor/autoload.php'; |
|
17 | 17 | |
18 | 18 | $emitter = new EventEmitter(); |
19 | 19 | |
20 | -$emitter->on('event', function () {}); |
|
20 | +$emitter->on('event', function() {}); |
|
21 | 21 | |
22 | 22 | $start = microtime(true); |
23 | 23 | for ($i = 0; $i < ITERATIONS; $i++) { |
@@ -13,11 +13,11 @@ |
||
13 | 13 | |
14 | 14 | use Evenement\EventEmitter; |
15 | 15 | |
16 | -require __DIR__.'/../vendor/autoload.php'; |
|
16 | +require __DIR__ . '/../vendor/autoload.php'; |
|
17 | 17 | |
18 | 18 | $emitter = new EventEmitter(); |
19 | 19 | |
20 | -$emitter->on('event', function ($a, $b, $c) {}); |
|
20 | +$emitter->on('event', function($a, $b, $c) {}); |
|
21 | 21 | |
22 | 22 | $start = microtime(true); |
23 | 23 | for ($i = 0; $i < ITERATIONS; $i++) { |
@@ -15,13 +15,13 @@ |
||
15 | 15 | |
16 | 16 | use Evenement\EventEmitter; |
17 | 17 | |
18 | -require __DIR__.'/../vendor/autoload.php'; |
|
18 | +require __DIR__ . '/../vendor/autoload.php'; |
|
19 | 19 | |
20 | 20 | $emitter = new EventEmitter(); |
21 | 21 | |
22 | 22 | $listeners = []; |
23 | 23 | for ($i = 0; $i < ITERATIONS; $i++) { |
24 | - $listeners[] = function ($a, $b, $c) {}; |
|
24 | + $listeners[] = function($a, $b, $c) {}; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | $start = microtime(true); |
@@ -15,12 +15,12 @@ |
||
15 | 15 | |
16 | 16 | use Evenement\EventEmitter; |
17 | 17 | |
18 | -require __DIR__.'/../vendor/autoload.php'; |
|
18 | +require __DIR__ . '/../vendor/autoload.php'; |
|
19 | 19 | |
20 | 20 | $emitter = new EventEmitter(); |
21 | 21 | |
22 | 22 | for ($i = 0; $i < ITERATIONS; $i++) { |
23 | - $emitter->once('event', function ($a, $b, $c) {}); |
|
23 | + $emitter->once('event', function($a, $b, $c) {}); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | $start = microtime(true); |
@@ -13,11 +13,11 @@ |
||
13 | 13 | |
14 | 14 | use Evenement\EventEmitter; |
15 | 15 | |
16 | -require __DIR__.'/../vendor/autoload.php'; |
|
16 | +require __DIR__ . '/../vendor/autoload.php'; |
|
17 | 17 | |
18 | 18 | $emitter = new EventEmitter(); |
19 | 19 | |
20 | -$emitter->on('event', function ($a) {}); |
|
20 | +$emitter->on('event', function($a) {}); |
|
21 | 21 | |
22 | 22 | $start = microtime(true); |
23 | 23 | for ($i = 0; $i < ITERATIONS; $i++) { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | public function testAddListenerWithLambda() |
28 | 28 | { |
29 | - $this->emitter->on('foo', function () {}); |
|
29 | + $this->emitter->on('foo', function() {}); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function testAddListenerWithMethod() |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $listenerCalled = 0; |
56 | 56 | |
57 | - $this->emitter->once('foo', function () use (&$listenerCalled) { |
|
57 | + $this->emitter->once('foo', function() use (&$listenerCalled) { |
|
58 | 58 | $listenerCalled++; |
59 | 59 | }); |
60 | 60 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | $capturedArgs = []; |
75 | 75 | |
76 | - $this->emitter->once('foo', function ($a, $b) use (&$capturedArgs) { |
|
76 | + $this->emitter->once('foo', function($a, $b) use (&$capturedArgs) { |
|
77 | 77 | $capturedArgs = array($a, $b); |
78 | 78 | }); |
79 | 79 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | $listenerCalled = false; |
88 | 88 | |
89 | - $this->emitter->on('foo', function () use (&$listenerCalled) { |
|
89 | + $this->emitter->on('foo', function() use (&$listenerCalled) { |
|
90 | 90 | $listenerCalled = true; |
91 | 91 | }); |
92 | 92 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | $listenerCalled = false; |
103 | 103 | |
104 | - $this->emitter->on('foo', function ($value) use (&$listenerCalled, $test) { |
|
104 | + $this->emitter->on('foo', function($value) use (&$listenerCalled, $test) { |
|
105 | 105 | $listenerCalled = true; |
106 | 106 | |
107 | 107 | $test->assertSame('bar', $value); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | $listenerCalled = false; |
120 | 120 | |
121 | - $this->emitter->on('foo', function ($arg1, $arg2) use (&$listenerCalled, $test) { |
|
121 | + $this->emitter->on('foo', function($arg1, $arg2) use (&$listenerCalled, $test) { |
|
122 | 122 | $listenerCalled = true; |
123 | 123 | |
124 | 124 | $test->assertSame('bar', $arg1); |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | { |
142 | 142 | $listenersCalled = 0; |
143 | 143 | |
144 | - $this->emitter->on('foo', function () use (&$listenersCalled) { |
|
144 | + $this->emitter->on('foo', function() use (&$listenersCalled) { |
|
145 | 145 | $listenersCalled++; |
146 | 146 | }); |
147 | 147 | |
148 | - $this->emitter->on('foo', function () use (&$listenersCalled) { |
|
148 | + $this->emitter->on('foo', function() use (&$listenersCalled) { |
|
149 | 149 | $listenersCalled++; |
150 | 150 | }); |
151 | 151 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | { |
159 | 159 | $listenersCalled = 0; |
160 | 160 | |
161 | - $listener = function () use (&$listenersCalled) { |
|
161 | + $listener = function() use (&$listenersCalled) { |
|
162 | 162 | $listenersCalled++; |
163 | 163 | }; |
164 | 164 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | { |
175 | 175 | $listenersCalled = 0; |
176 | 176 | |
177 | - $listener = function () use (&$listenersCalled) { |
|
177 | + $listener = function() use (&$listenersCalled) { |
|
178 | 178 | $listenersCalled++; |
179 | 179 | }; |
180 | 180 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | { |
191 | 191 | $listenersCalled = 0; |
192 | 192 | |
193 | - $this->emitter->on('foo', function () use (&$listenersCalled) { |
|
193 | + $this->emitter->on('foo', function() use (&$listenersCalled) { |
|
194 | 194 | $listenersCalled++; |
195 | 195 | }); |
196 | 196 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | { |
206 | 206 | $listenersCalled = 0; |
207 | 207 | |
208 | - $this->emitter->on('foo', function () use (&$listenersCalled) { |
|
208 | + $this->emitter->on('foo', function() use (&$listenersCalled) { |
|
209 | 209 | $listenersCalled++; |
210 | 210 | }); |
211 | 211 | |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | { |
221 | 221 | $listenersCalled = 0; |
222 | 222 | |
223 | - $this->emitter->on('foo', function () use (&$listenersCalled) { |
|
223 | + $this->emitter->on('foo', function() use (&$listenersCalled) { |
|
224 | 224 | $listenersCalled++; |
225 | 225 | }); |
226 | 226 | |
227 | - $this->emitter->on('bar', function () use (&$listenersCalled) { |
|
227 | + $this->emitter->on('bar', function() use (&$listenersCalled) { |
|
228 | 228 | $listenersCalled++; |
229 | 229 | }); |
230 | 230 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | { |
241 | 241 | $calledWith = null; |
242 | 242 | |
243 | - $this->emitter->on('foo', function ($data) use (&$calledWith) { |
|
243 | + $this->emitter->on('foo', function($data) use (&$calledWith) { |
|
244 | 244 | $calledWith = $data; |
245 | 245 | }); |
246 | 246 | |
@@ -292,12 +292,12 @@ discard block |
||
292 | 292 | |
293 | 293 | public function testListeners() |
294 | 294 | { |
295 | - $onA = function () {}; |
|
296 | - $onB = function () {}; |
|
297 | - $onC = function () {}; |
|
298 | - $onceA = function () {}; |
|
299 | - $onceB = function () {}; |
|
300 | - $onceC = function () {}; |
|
295 | + $onA = function() {}; |
|
296 | + $onB = function() {}; |
|
297 | + $onC = function() {}; |
|
298 | + $onceA = function() {}; |
|
299 | + $onceB = function() {}; |
|
300 | + $onceC = function() {}; |
|
301 | 301 | |
302 | 302 | self::assertCount(0, $this->emitter->listeners('event')); |
303 | 303 | $this->emitter->on('event', $onA); |
@@ -335,11 +335,11 @@ discard block |
||
335 | 335 | public function testOnceCallIsNotRemovedWhenWorkingOverOnceListeners() |
336 | 336 | { |
337 | 337 | $aCalled = false; |
338 | - $aCallable = function () use (&$aCalled) { |
|
338 | + $aCallable = function() use (&$aCalled) { |
|
339 | 339 | $aCalled = true; |
340 | 340 | }; |
341 | 341 | $bCalled = false; |
342 | - $bCallable = function () use (&$bCalled, $aCallable) { |
|
342 | + $bCallable = function() use (&$bCalled, $aCallable) { |
|
343 | 343 | $bCalled = true; |
344 | 344 | $this->emitter->once('event', $aCallable); |
345 | 345 | }; |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | self::expectException(InvalidArgumentException::class); |
363 | 363 | self::expectExceptionMessage('event name must not be null'); |
364 | 364 | |
365 | - $this->emitter->on(null, function () {}); |
|
365 | + $this->emitter->on(null, function() {}); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | public function testEventNameMustBeStringOnce() |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | self::expectException(InvalidArgumentException::class); |
371 | 371 | self::expectExceptionMessage('event name must not be null'); |
372 | 372 | |
373 | - $this->emitter->once(null, function () {}); |
|
373 | + $this->emitter->once(null, function() {}); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | public function testEventNameMustBeStringRemoveListener() |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | self::expectException(InvalidArgumentException::class); |
379 | 379 | self::expectExceptionMessage('event name must not be null'); |
380 | 380 | |
381 | - $this->emitter->removeListener(null, function () {}); |
|
381 | + $this->emitter->removeListener(null, function() {}); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | public function testEventNameMustBeStringEmit() |
@@ -391,10 +391,10 @@ discard block |
||
391 | 391 | |
392 | 392 | public function testListenersGetAll() |
393 | 393 | { |
394 | - $a = function () {}; |
|
395 | - $b = function () {}; |
|
396 | - $c = function () {}; |
|
397 | - $d = function () {}; |
|
394 | + $a = function() {}; |
|
395 | + $b = function() {}; |
|
396 | + $c = function() {}; |
|
397 | + $d = function() {}; |
|
398 | 398 | |
399 | 399 | $this->emitter->once('event2', $c); |
400 | 400 | $this->emitter->on('event', $a); |
@@ -423,9 +423,9 @@ discard block |
||
423 | 423 | $first = 0; |
424 | 424 | $second = 0; |
425 | 425 | |
426 | - $this->emitter->once('event', function () use (&$first, &$second) { |
|
426 | + $this->emitter->once('event', function() use (&$first, &$second) { |
|
427 | 427 | $first++; |
428 | - $this->emitter->once('event', function () use (&$second) { |
|
428 | + $this->emitter->once('event', function() use (&$second) { |
|
429 | 429 | $second++; |
430 | 430 | }); |
431 | 431 | $this->emitter->emit('event'); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | use Symfony\Polyfill\Mbstring as p; |
13 | 13 | |
14 | 14 | if (!function_exists('mb_convert_encoding')) { |
15 | - function mb_convert_encoding(array|string|null $string, ?string $to_encoding, array|string|null $from_encoding = null): array|string|false { return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); } |
|
15 | + function mb_convert_encoding(array | string | null $string, ?string $to_encoding, array | string | null $from_encoding = null): array | string | false { return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); } |
|
16 | 16 | } |
17 | 17 | if (!function_exists('mb_decode_mimeheader')) { |
18 | 18 | function mb_decode_mimeheader(?string $string): string { return p\Mbstring::mb_decode_mimeheader((string) $string); } |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | function mb_convert_case(?string $string, ?int $mode, ?string $encoding = null): string { return p\Mbstring::mb_convert_case((string) $string, (int) $mode, $encoding); } |
31 | 31 | } |
32 | 32 | if (!function_exists('mb_internal_encoding')) { |
33 | - function mb_internal_encoding(?string $encoding = null): string|bool { return p\Mbstring::mb_internal_encoding($encoding); } |
|
33 | + function mb_internal_encoding(?string $encoding = null): string | bool { return p\Mbstring::mb_internal_encoding($encoding); } |
|
34 | 34 | } |
35 | 35 | if (!function_exists('mb_language')) { |
36 | - function mb_language(?string $language = null): string|bool { return p\Mbstring::mb_language($language); } |
|
36 | + function mb_language(?string $language = null): string | bool { return p\Mbstring::mb_language($language); } |
|
37 | 37 | } |
38 | 38 | if (!function_exists('mb_list_encodings')) { |
39 | 39 | function mb_list_encodings(): array { return p\Mbstring::mb_list_encodings(); } |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | function mb_encoding_aliases(?string $encoding): array { return p\Mbstring::mb_encoding_aliases((string) $encoding); } |
43 | 43 | } |
44 | 44 | if (!function_exists('mb_check_encoding')) { |
45 | - function mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); } |
|
45 | + function mb_check_encoding(array | string | null $value = null, ?string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); } |
|
46 | 46 | } |
47 | 47 | if (!function_exists('mb_detect_encoding')) { |
48 | - function mb_detect_encoding(?string $string, array|string|null $encodings = null, ?bool $strict = false): string|false { return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); } |
|
48 | + function mb_detect_encoding(?string $string, array | string | null $encodings = null, ?bool $strict = false): string | false { return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); } |
|
49 | 49 | } |
50 | 50 | if (!function_exists('mb_detect_order')) { |
51 | - function mb_detect_order(array|string|null $encoding = null): array|bool { return p\Mbstring::mb_detect_order($encoding); } |
|
51 | + function mb_detect_order(array | string | null $encoding = null): array | bool { return p\Mbstring::mb_detect_order($encoding); } |
|
52 | 52 | } |
53 | 53 | if (!function_exists('mb_parse_str')) { |
54 | 54 | function mb_parse_str(?string $string, &$result = []): bool { parse_str((string) $string, $result); return (bool) $result; } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | function mb_strlen(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strlen((string) $string, $encoding); } |
58 | 58 | } |
59 | 59 | if (!function_exists('mb_strpos')) { |
60 | - function mb_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
60 | + function mb_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int | false { return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
61 | 61 | } |
62 | 62 | if (!function_exists('mb_strtolower')) { |
63 | 63 | function mb_strtolower(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtolower((string) $string, $encoding); } |
@@ -66,37 +66,37 @@ discard block |
||
66 | 66 | function mb_strtoupper(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtoupper((string) $string, $encoding); } |
67 | 67 | } |
68 | 68 | if (!function_exists('mb_substitute_character')) { |
69 | - function mb_substitute_character(string|int|null $substitute_character = null): string|int|bool { return p\Mbstring::mb_substitute_character($substitute_character); } |
|
69 | + function mb_substitute_character(string | int | null $substitute_character = null): string | int | bool { return p\Mbstring::mb_substitute_character($substitute_character); } |
|
70 | 70 | } |
71 | 71 | if (!function_exists('mb_substr')) { |
72 | 72 | function mb_substr(?string $string, ?int $start, ?int $length = null, ?string $encoding = null): string { return p\Mbstring::mb_substr((string) $string, (int) $start, $length, $encoding); } |
73 | 73 | } |
74 | 74 | if (!function_exists('mb_stripos')) { |
75 | - function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
75 | + function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int | false { return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
76 | 76 | } |
77 | 77 | if (!function_exists('mb_stristr')) { |
78 | - function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
78 | + function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string | false { return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
79 | 79 | } |
80 | 80 | if (!function_exists('mb_strrchr')) { |
81 | - function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
81 | + function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string | false { return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
82 | 82 | } |
83 | 83 | if (!function_exists('mb_strrichr')) { |
84 | - function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
84 | + function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string | false { return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
85 | 85 | } |
86 | 86 | if (!function_exists('mb_strripos')) { |
87 | - function mb_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
87 | + function mb_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int | false { return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
88 | 88 | } |
89 | 89 | if (!function_exists('mb_strrpos')) { |
90 | - function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
90 | + function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int | false { return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
91 | 91 | } |
92 | 92 | if (!function_exists('mb_strstr')) { |
93 | - function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
93 | + function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string | false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
94 | 94 | } |
95 | 95 | if (!function_exists('mb_get_info')) { |
96 | - function mb_get_info(?string $type = 'all'): array|string|int|false { return p\Mbstring::mb_get_info((string) $type); } |
|
96 | + function mb_get_info(?string $type = 'all'): array | string | int | false { return p\Mbstring::mb_get_info((string) $type); } |
|
97 | 97 | } |
98 | 98 | if (!function_exists('mb_http_output')) { |
99 | - function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); } |
|
99 | + function mb_http_output(?string $encoding = null): string | bool { return p\Mbstring::mb_http_output($encoding); } |
|
100 | 100 | } |
101 | 101 | if (!function_exists('mb_strwidth')) { |
102 | 102 | function mb_strwidth(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strwidth((string) $string, $encoding); } |
@@ -108,18 +108,18 @@ discard block |
||
108 | 108 | function mb_output_handler(?string $string, ?int $status): string { return p\Mbstring::mb_output_handler((string) $string, (int) $status); } |
109 | 109 | } |
110 | 110 | if (!function_exists('mb_http_input')) { |
111 | - function mb_http_input(?string $type = null): array|string|false { return p\Mbstring::mb_http_input($type); } |
|
111 | + function mb_http_input(?string $type = null): array | string | false { return p\Mbstring::mb_http_input($type); } |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | if (!function_exists('mb_convert_variables')) { |
115 | - function mb_convert_variables(?string $to_encoding, array|string|null $from_encoding, mixed &$var, mixed &...$vars): string|false { return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); } |
|
115 | + function mb_convert_variables(?string $to_encoding, array | string | null $from_encoding, mixed &$var, mixed &...$vars): string | false { return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); } |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | if (!function_exists('mb_ord')) { |
119 | - function mb_ord(?string $string, ?string $encoding = null): int|false { return p\Mbstring::mb_ord((string) $string, $encoding); } |
|
119 | + function mb_ord(?string $string, ?string $encoding = null): int | false { return p\Mbstring::mb_ord((string) $string, $encoding); } |
|
120 | 120 | } |
121 | 121 | if (!function_exists('mb_chr')) { |
122 | - function mb_chr(?int $codepoint, ?string $encoding = null): string|false { return p\Mbstring::mb_chr((int) $codepoint, $encoding); } |
|
122 | + function mb_chr(?int $codepoint, ?string $encoding = null): string | false { return p\Mbstring::mb_chr((int) $codepoint, $encoding); } |
|
123 | 123 | } |
124 | 124 | if (!function_exists('mb_scrub')) { |
125 | 125 | function mb_scrub(?string $string, ?string $encoding = null): string { $encoding ??= mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | private const CASE_FOLD = [ |
73 | 73 | ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"], |
74 | - ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'], |
|
74 | + ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'], |
|
75 | 75 | ]; |
76 | 76 | |
77 | 77 | private static $encodingList = ['ASCII', 'UTF-8']; |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | $fromEncoding = 'UTF-8'; |
114 | 114 | } |
115 | 115 | |
116 | - return \iconv($fromEncoding, $toEncoding.'//IGNORE', $s); |
|
116 | + return \iconv($fromEncoding, $toEncoding . '//IGNORE', $s); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | public static function mb_convert_variables($toEncoding, $fromEncoding, &...$vars) |
120 | 120 | { |
121 | 121 | $ok = true; |
122 | - array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) { |
|
122 | + array_walk_recursive($vars, function(&$v) use (&$ok, $toEncoding, $fromEncoding) { |
|
123 | 123 | if (false === $v = self::mb_convert_encoding($v, $toEncoding, $fromEncoding)) { |
124 | 124 | $ok = false; |
125 | 125 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public static function mb_decode_numericentity($s, $convmap, $encoding = null) |
142 | 142 | { |
143 | 143 | if (null !== $s && !is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) { |
144 | - trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
|
144 | + trigger_error('mb_decode_numericentity() expects parameter 1 to be string, ' . \gettype($s) . ' given', \E_USER_WARNING); |
|
145 | 145 | |
146 | 146 | return null; |
147 | 147 | } |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | if (null !== $encoding && !is_scalar($encoding)) { |
154 | - trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
|
154 | + trigger_error('mb_decode_numericentity() expects parameter 3 to be string, ' . \gettype($s) . ' given', \E_USER_WARNING); |
|
155 | 155 | |
156 | - return ''; // Instead of null (cf. mb_encode_numericentity). |
|
156 | + return ''; // Instead of null (cf. mb_encode_numericentity). |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | $s = (string) $s; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $convmap[$i + 1] += $convmap[$i + 2]; |
181 | 181 | } |
182 | 182 | |
183 | - $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) { |
|
183 | + $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function(array $m) use ($cnt, $convmap) { |
|
184 | 184 | $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1]; |
185 | 185 | for ($i = 0; $i < $cnt; $i += 4) { |
186 | 186 | if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) { |
@@ -195,13 +195,13 @@ discard block |
||
195 | 195 | return $s; |
196 | 196 | } |
197 | 197 | |
198 | - return \iconv('UTF-8', $encoding.'//IGNORE', $s); |
|
198 | + return \iconv('UTF-8', $encoding . '//IGNORE', $s); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false) |
202 | 202 | { |
203 | 203 | if (null !== $s && !is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) { |
204 | - trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
|
204 | + trigger_error('mb_encode_numericentity() expects parameter 1 to be string, ' . \gettype($s) . ' given', \E_USER_WARNING); |
|
205 | 205 | |
206 | 206 | return null; |
207 | 207 | } |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | if (null !== $encoding && !is_scalar($encoding)) { |
214 | - trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
|
214 | + trigger_error('mb_encode_numericentity() expects parameter 3 to be string, ' . \gettype($s) . ' given', \E_USER_WARNING); |
|
215 | 215 | |
216 | - return null; // Instead of '' (cf. mb_decode_numericentity). |
|
216 | + return null; // Instead of '' (cf. mb_decode_numericentity). |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | if (null !== $is_hex && !is_scalar($is_hex)) { |
220 | - trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', \E_USER_WARNING); |
|
220 | + trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, ' . \gettype($s) . ' given', \E_USER_WARNING); |
|
221 | 221 | |
222 | 222 | return null; |
223 | 223 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | for ($j = 0; $j < $cnt; $j += 4) { |
255 | 255 | if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) { |
256 | 256 | $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3]; |
257 | - $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';'; |
|
257 | + $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#' . $cOffset . ';'; |
|
258 | 258 | continue 2; |
259 | 259 | } |
260 | 260 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | return $result; |
266 | 266 | } |
267 | 267 | |
268 | - return \iconv('UTF-8', $encoding.'//IGNORE', $result); |
|
268 | + return \iconv('UTF-8', $encoding . '//IGNORE', $result); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | public static function mb_convert_case($s, $mode, $encoding = null) |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | return $s; |
344 | 344 | } |
345 | 345 | |
346 | - return \iconv('UTF-8', $encoding.'//IGNORE', $s); |
|
346 | + return \iconv('UTF-8', $encoding . '//IGNORE', $s); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | public static function mb_internal_encoding($encoding = null) |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | $needle = (string) $needle; |
502 | 502 | if ('' === $needle) { |
503 | 503 | if (80000 > \PHP_VERSION_ID) { |
504 | - trigger_error(__METHOD__.': Empty delimiter', \E_USER_WARNING); |
|
504 | + trigger_error(__METHOD__ . ': Empty delimiter', \E_USER_WARNING); |
|
505 | 505 | |
506 | 506 | return false; |
507 | 507 | } |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | public static function mb_str_split($string, $split_length = 1, $encoding = null) |
543 | 543 | { |
544 | 544 | if (null !== $string && !is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) { |
545 | - trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', \E_USER_WARNING); |
|
545 | + trigger_error('mb_str_split() expects parameter 1 to be string, ' . \gettype($string) . ' given', \E_USER_WARNING); |
|
546 | 546 | |
547 | 547 | return null; |
548 | 548 | } |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | $rx .= '.{65535}'; |
567 | 567 | $split_length -= 65535; |
568 | 568 | } |
569 | - $rx .= '.{'.$split_length.'})/us'; |
|
569 | + $rx .= '.{' . $split_length . '})/us'; |
|
570 | 570 | |
571 | 571 | return preg_split($rx, $string, null, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY); |
572 | 572 | } |
@@ -759,11 +759,11 @@ discard block |
||
759 | 759 | if (0x80 > $code %= 0x200000) { |
760 | 760 | $s = \chr($code); |
761 | 761 | } elseif (0x800 > $code) { |
762 | - $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F); |
|
762 | + $s = \chr(0xC0 | $code >> 6) . \chr(0x80 | $code & 0x3F); |
|
763 | 763 | } elseif (0x10000 > $code) { |
764 | - $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); |
|
764 | + $s = \chr(0xE0 | $code >> 12) . \chr(0x80 | $code >> 6 & 0x3F) . \chr(0x80 | $code & 0x3F); |
|
765 | 765 | } else { |
766 | - $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); |
|
766 | + $s = \chr(0xF0 | $code >> 18) . \chr(0x80 | $code >> 12 & 0x3F) . \chr(0x80 | $code >> 6 & 0x3F) . \chr(0x80 | $code & 0x3F); |
|
767 | 767 | } |
768 | 768 | |
769 | 769 | if ('UTF-8' !== $encoding = self::getEncoding($encoding)) { |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80; |
829 | 829 | } |
830 | 830 | |
831 | - $entities .= '&#'.$c.';'; |
|
831 | + $entities .= '&#' . $c . ';'; |
|
832 | 832 | } |
833 | 833 | |
834 | 834 | return $entities; |
@@ -836,12 +836,12 @@ discard block |
||
836 | 836 | |
837 | 837 | private static function title_case(array $s) |
838 | 838 | { |
839 | - return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8'); |
|
839 | + return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8') . self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8'); |
|
840 | 840 | } |
841 | 841 | |
842 | 842 | private static function getData($file) |
843 | 843 | { |
844 | - if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) { |
|
844 | + if (file_exists($file = __DIR__ . '/Resources/unidata/' . $file . '.php')) { |
|
845 | 845 | return require $file; |
846 | 846 | } |
847 | 847 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | if ($php = getenv('PHP_BINARY')) { |
37 | 37 | if (!is_executable($php)) { |
38 | 38 | $command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v'; |
39 | - if ($php = strtok(exec($command.' '.escapeshellarg($php)), \PHP_EOL)) { |
|
39 | + if ($php = strtok(exec($command . ' ' . escapeshellarg($php)), \PHP_EOL)) { |
|
40 | 40 | if (!is_executable($php)) { |
41 | 41 | return false; |
42 | 42 | } |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | $args = $this->findArguments(); |
52 | - $args = $includeArgs && $args ? ' '.implode(' ', $args) : ''; |
|
52 | + $args = $includeArgs && $args ? ' ' . implode(' ', $args) : ''; |
|
53 | 53 | |
54 | 54 | // PHP_BINARY return the current sapi executable |
55 | 55 | if (\PHP_BINARY && \in_array(\PHP_SAPI, ['cgi-fcgi', 'cli', 'cli-server', 'phpdbg'], true)) { |
56 | - return \PHP_BINARY.$args; |
|
56 | + return \PHP_BINARY . $args; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | if ($php = getenv('PHP_PATH')) { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | - if (@is_executable($php = \PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) { |
|
73 | + if (@is_executable($php = \PHP_BINDIR . ('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) { |
|
74 | 74 | return $php; |
75 | 75 | } |
76 | 76 |