@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param string $string |
| 49 | 49 | * @return string |
| 50 | 50 | */ |
| 51 | - return function (string $string) use ($opening, $closing): string { |
|
| 51 | + return function(string $string) use ($opening, $closing) : string { |
|
| 52 | 52 | return \sprintf('%s%s%s', $opening, $string, $closing ?? $opening); |
| 53 | 53 | }; |
| 54 | 54 | } |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | * @param string $string |
| 69 | 69 | * @return string |
| 70 | 70 | */ |
| 71 | - return function (string $string) use ($start, $finish): string { |
|
| 72 | - return ! $finish |
|
| 71 | + return function(string $string) use ($start, $finish) : string { |
|
| 72 | + return !$finish |
|
| 73 | 73 | ? substr($string, $start) |
| 74 | 74 | : substr($string, $start, $finish); |
| 75 | 75 | }; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @param string $string |
| 88 | 88 | * @return string |
| 89 | 89 | */ |
| 90 | - return function (string $string) use ($prepend): string { |
|
| 90 | + return function(string $string) use ($prepend): string { |
|
| 91 | 91 | return \sprintf('%s%s', $prepend, $string); |
| 92 | 92 | }; |
| 93 | 93 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @param string $string |
| 105 | 105 | * @return string |
| 106 | 106 | */ |
| 107 | - return function (string $string) use ($append): string { |
|
| 107 | + return function(string $string) use ($append): string { |
|
| 108 | 108 | return \sprintf('%s%s', $string, $append); |
| 109 | 109 | }; |
| 110 | 110 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @param array<string, mixed> $values |
| 122 | 122 | * @return string Will return original string if false. |
| 123 | 123 | */ |
| 124 | - return function (array $values = array()) use ($template): string { |
|
| 124 | + return function(array $values = array()) use ($template): string { |
|
| 125 | 125 | return \vsprintf($template, $values); |
| 126 | 126 | }; |
| 127 | 127 | } |
@@ -138,12 +138,12 @@ discard block |
||
| 138 | 138 | * @param string $replace value to replace with |
| 139 | 139 | * @return Closure(string):string |
| 140 | 140 | */ |
| 141 | - return function (string $replace) use ($find): Closure { |
|
| 141 | + return function(string $replace) use ($find): Closure { |
|
| 142 | 142 | /** |
| 143 | 143 | * @param string $subject String to carry out find and replace. |
| 144 | 144 | * @return string |
| 145 | 145 | */ |
| 146 | - return function ($subject) use ($find, $replace): string { |
|
| 146 | + return function($subject) use ($find, $replace): string { |
|
| 147 | 147 | return \str_replace($find, $replace, $subject); |
| 148 | 148 | }; |
| 149 | 149 | }; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * @param string $source |
| 163 | 163 | * @return string |
| 164 | 164 | */ |
| 165 | - return function ($source) use ($find, $replace): string { |
|
| 165 | + return function($source) use ($find, $replace): string { |
|
| 166 | 166 | return \str_replace($find, $replace, $source); |
| 167 | 167 | }; |
| 168 | 168 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * @param string $string |
| 182 | 182 | * @return string |
| 183 | 183 | */ |
| 184 | - return function (string $string) use ($replace, $offset, $length): string { |
|
| 184 | + return function(string $string) use ($replace, $offset, $length) : string { |
|
| 185 | 185 | return $length |
| 186 | 186 | ? \substr_replace($string, $replace, $offset, $length) |
| 187 | 187 | : \substr_replace($string, $replace, $offset); |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * @param string $source |
| 201 | 201 | * @return bool |
| 202 | 202 | */ |
| 203 | - return function (string $source) use ($find): bool { |
|
| 203 | + return function(string $source) use ($find): bool { |
|
| 204 | 204 | return (\substr($source, 0, \strlen($find)) === $find); |
| 205 | 205 | }; |
| 206 | 206 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * @param string $source |
| 218 | 218 | * @return bool |
| 219 | 219 | */ |
| 220 | - return function (string $source) use ($find): bool { |
|
| 220 | + return function(string $source) use ($find): bool { |
|
| 221 | 221 | if (\strlen($find) === 0) { |
| 222 | 222 | return true; |
| 223 | 223 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | * @param string $haystack String to look in. |
| 238 | 238 | * @return bool |
| 239 | 239 | */ |
| 240 | - return function (string $haystack) use ($needle): bool { |
|
| 240 | + return function(string $haystack) use ($needle): bool { |
|
| 241 | 241 | return \stringContains($haystack, $needle); |
| 242 | 242 | }; |
| 243 | 243 | } |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | * @param string $source String to look in. |
| 255 | 255 | * @return bool |
| 256 | 256 | */ |
| 257 | - return function (string $source) use ($pattern): bool { |
|
| 257 | + return function(string $source) use ($pattern): bool { |
|
| 258 | 258 | return (bool) \preg_match($pattern, $source); |
| 259 | 259 | }; |
| 260 | 260 | } |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * @param string $name |
| 272 | 272 | * @return string[] |
| 273 | 273 | */ |
| 274 | - return function (string $string) use ($pattern): ?array { |
|
| 274 | + return function(string $string) use ($pattern): ?array { |
|
| 275 | 275 | return \preg_split($pattern, $string) ?: null; |
| 276 | 276 | }; |
| 277 | 277 | } |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | * @param string|int|float $number |
| 291 | 291 | * @return string |
| 292 | 292 | */ |
| 293 | - return function ($number) use ($precision, $point, $thousands): string { |
|
| 293 | + return function($number) use ($precision, $point, $thousands): string { |
|
| 294 | 294 | return \is_numeric($number) |
| 295 | 295 | ? \number_format((float) $number, (int) $precision, $point, $thousands) |
| 296 | 296 | : ''; |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | * @param string $string The string to have char, slash escaped. |
| 312 | 312 | * @return string |
| 313 | 313 | */ |
| 314 | - return function (string $string) use ($charList): string { |
|
| 314 | + return function(string $string) use ($charList): string { |
|
| 315 | 315 | return \addcslashes($string, $charList); |
| 316 | 316 | }; |
| 317 | 317 | } |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | * @param string $string The string to be split |
| 330 | 330 | * @return array<int, string> |
| 331 | 331 | */ |
| 332 | - return function (string $string) use ($separator, $limit): array { |
|
| 332 | + return function(string $string) use ($separator, $limit): array { |
|
| 333 | 333 | $chunks = explode($separator, $string, $limit); |
| 334 | 334 | return is_array($chunks) ? $chunks : array(); // @phpstan-ignore-line, inconsistent errors with differing php versions. |
| 335 | 335 | }; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | * @param string $string The string to be split |
| 348 | 348 | * @return array<int, string> |
| 349 | 349 | */ |
| 350 | - return function (string $string) use ($length): array { |
|
| 350 | + return function(string $string) use ($length): array { |
|
| 351 | 351 | return \str_split($string, max(1, $length)) ?: array(); // @phpstan-ignore-line, inconsistent errors with differing php versions. |
| 352 | 352 | }; |
| 353 | 353 | } |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | * @param string $string The string to be chunked |
| 367 | 367 | * @return string |
| 368 | 368 | */ |
| 369 | - return function (string $string) use ($length, $end): string { |
|
| 369 | + return function(string $string) use ($length, $end): string { |
|
| 370 | 370 | return \chunk_split($string, max(1, $length), $end); |
| 371 | 371 | }; |
| 372 | 372 | } |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | * @param string $string The string to be wrapped |
| 386 | 386 | * @return string |
| 387 | 387 | */ |
| 388 | - return function (string $string) use ($width, $break, $cut): string { |
|
| 388 | + return function(string $string) use ($width, $break, $cut): string { |
|
| 389 | 389 | return \wordwrap($string, $width, $break, $cut); |
| 390 | 390 | }; |
| 391 | 391 | } |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | function countChars(int $mode = 1): Closure |
| 401 | 401 | { |
| 402 | 402 | // Throw an exception if the mode is not supported. |
| 403 | - if (! in_array($mode, array( 0, 1, 2, 3, 4 ), true)) { |
|
| 403 | + if (!in_array($mode, array(0, 1, 2, 3, 4), true)) { |
|
| 404 | 404 | throw new \InvalidArgumentException('Invalid mode'); |
| 405 | 405 | } |
| 406 | 406 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | * @param string $string The string to have its char counted. |
| 409 | 409 | * @return int[]|string |
| 410 | 410 | */ |
| 411 | - return function (string $string) use ($mode) { |
|
| 411 | + return function(string $string) use ($mode) { |
|
| 412 | 412 | return \count_chars($string, $mode); |
| 413 | 413 | }; |
| 414 | 414 | } |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | * @param string $haystack |
| 428 | 428 | * @return int |
| 429 | 429 | */ |
| 430 | - return function (string $haystack) use ($needle, $offset, $length): int { |
|
| 430 | + return function(string $haystack) use ($needle, $offset, $length) : int { |
|
| 431 | 431 | return $length |
| 432 | 432 | ? \substr_count($haystack, $needle, $offset, $length) |
| 433 | 433 | : \substr_count($haystack, $needle, $offset); |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | * @param string $string The string to be trimmed |
| 447 | 447 | * @return string |
| 448 | 448 | */ |
| 449 | - return function (string $string) use ($mask): string { |
|
| 449 | + return function(string $string) use ($mask): string { |
|
| 450 | 450 | return \trim($string, $mask); |
| 451 | 451 | }; |
| 452 | 452 | } |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | * @param string $string The string to be trimmed |
| 464 | 464 | * @return string |
| 465 | 465 | */ |
| 466 | - return function (string $string) use ($mask): string { |
|
| 466 | + return function(string $string) use ($mask): string { |
|
| 467 | 467 | return \ltrim($string, $mask); |
| 468 | 468 | }; |
| 469 | 469 | } |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | * @param string $string The string to be trimmed |
| 481 | 481 | * @return string |
| 482 | 482 | */ |
| 483 | - return function (string $string) use ($mask): string { |
|
| 483 | + return function(string $string) use ($mask): string { |
|
| 484 | 484 | return \rtrim($string, $mask); |
| 485 | 485 | }; |
| 486 | 486 | } |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | * @param string $comparisonString The string to compare against base. |
| 500 | 500 | * @return Number |
| 501 | 501 | */ |
| 502 | - return function (string $comparisonString) use ($base, $asPc) { |
|
| 502 | + return function(string $comparisonString) use ($base, $asPc) { |
|
| 503 | 503 | $pc = 0.00; |
| 504 | 504 | $matching = similar_text($base, $comparisonString, $pc); |
| 505 | 505 | return $asPc ? $pc : $matching; |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | * @param string $comparisonString The string to act as the base. |
| 521 | 521 | * @return Number |
| 522 | 522 | */ |
| 523 | - return function (string $base) use ($comparisonString, $asPc) { |
|
| 523 | + return function(string $base) use ($comparisonString, $asPc) { |
|
| 524 | 524 | $pc = 0.00; |
| 525 | 525 | $matching = similar_text($base, $comparisonString, $pc); |
| 526 | 526 | return $asPc ? $pc : $matching; |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | * @param string $string The string to pad out. |
| 542 | 542 | * @return string |
| 543 | 543 | */ |
| 544 | - return function (string $string) use ($length, $padContent, $type): string { |
|
| 544 | + return function(string $string) use ($length, $padContent, $type): string { |
|
| 545 | 545 | return \str_pad($string, $length, $padContent, $type); |
| 546 | 546 | }; |
| 547 | 547 | } |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | * @param string $string The string to repeat |
| 559 | 559 | * @return string |
| 560 | 560 | */ |
| 561 | - return function (string $string) use ($count): string { |
|
| 561 | + return function(string $string) use ($count): string { |
|
| 562 | 562 | return \str_repeat($string, $count); |
| 563 | 563 | }; |
| 564 | 564 | } |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | * @param string $string The string to pad out. |
| 577 | 577 | * @return int|string[] |
| 578 | 578 | */ |
| 579 | - return function (string $string) use ($format, $charList) { |
|
| 579 | + return function(string $string) use ($format, $charList) { |
|
| 580 | 580 | return $charList |
| 581 | 581 | ? (\str_word_count($string, $format, $charList) ?: 0) |
| 582 | 582 | : (\str_word_count($string, $format) ?: 0); |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | * @param string $string The string to strip tags from. |
| 596 | 596 | * @return string |
| 597 | 597 | */ |
| 598 | - return function (string $string) use ($allowedTags): string { |
|
| 598 | + return function(string $string) use ($allowedTags) : string { |
|
| 599 | 599 | return $allowedTags |
| 600 | 600 | ? \strip_tags($string, $allowedTags) |
| 601 | 601 | : \strip_tags($string); |
@@ -612,13 +612,13 @@ discard block |
||
| 612 | 612 | */ |
| 613 | 613 | function firstPosition(string $needle, int $offset = 0, int $flags = STRINGS_CASE_SENSITIVE): Closure |
| 614 | 614 | { |
| 615 | - $caseSensitive = ! (bool) ($flags & STRINGS_CASE_INSENSITIVE); // Assumes true unless INSESNITVE passed |
|
| 615 | + $caseSensitive = !(bool) ($flags & STRINGS_CASE_INSENSITIVE); // Assumes true unless INSESNITVE passed |
|
| 616 | 616 | |
| 617 | 617 | /** |
| 618 | 618 | * @param string $haystack The haystack to look through. |
| 619 | 619 | * @return int|null |
| 620 | 620 | */ |
| 621 | - return function (string $haystack) use ($needle, $offset, $caseSensitive): ?int { |
|
| 621 | + return function(string $haystack) use ($needle, $offset, $caseSensitive): ?int { |
|
| 622 | 622 | $pos = $caseSensitive |
| 623 | 623 | ? strpos($haystack, $needle, $offset) |
| 624 | 624 | : stripos($haystack, $needle, $offset); |
@@ -636,13 +636,13 @@ discard block |
||
| 636 | 636 | */ |
| 637 | 637 | function lastPosition(string $needle, int $offset = 0, int $flags = STRINGS_CASE_SENSITIVE): Closure |
| 638 | 638 | { |
| 639 | - $caseSensitive = ! (bool) ($flags & STRINGS_CASE_INSENSITIVE); // Assumes true unless INSESNITVE passed |
|
| 639 | + $caseSensitive = !(bool) ($flags & STRINGS_CASE_INSENSITIVE); // Assumes true unless INSESNITVE passed |
|
| 640 | 640 | |
| 641 | 641 | /** |
| 642 | 642 | * @param string $haystack The haystack to look through. |
| 643 | 643 | * @return int|null |
| 644 | 644 | */ |
| 645 | - return function (string $haystack) use ($needle, $offset, $caseSensitive): ?int { |
|
| 645 | + return function(string $haystack) use ($needle, $offset, $caseSensitive): ?int { |
|
| 646 | 646 | $pos = $caseSensitive |
| 647 | 647 | ? strrpos($haystack, $needle, $offset) |
| 648 | 648 | : strripos($haystack, $needle, $offset); |
@@ -663,13 +663,13 @@ discard block |
||
| 663 | 663 | { |
| 664 | 664 | // Decode flags, only look for none defaults. |
| 665 | 665 | $beforeNeedle = (bool) ($flags & STRINGS_BEFORE_NEEDLE); |
| 666 | - $caseSensitive = ! (bool) ($flags & STRINGS_CASE_INSENSITIVE); // Assumes true unless INSESNITVE passed |
|
| 666 | + $caseSensitive = !(bool) ($flags & STRINGS_CASE_INSENSITIVE); // Assumes true unless INSESNITVE passed |
|
| 667 | 667 | |
| 668 | 668 | /** |
| 669 | 669 | * @param string $haystack The haystack to look through. |
| 670 | 670 | * @return string |
| 671 | 671 | */ |
| 672 | - return function (string $haystack) use ($needle, $beforeNeedle, $caseSensitive): string { |
|
| 672 | + return function(string $haystack) use ($needle, $beforeNeedle, $caseSensitive): string { |
|
| 673 | 673 | $result = $caseSensitive |
| 674 | 674 | ? strstr($haystack, $needle, $beforeNeedle) |
| 675 | 675 | : stristr($haystack, $needle, $beforeNeedle); |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | * @param string $haystack |
| 691 | 691 | * @return string |
| 692 | 692 | */ |
| 693 | - return function (string $haystack) use ($chars): string { |
|
| 693 | + return function(string $haystack) use ($chars): string { |
|
| 694 | 694 | $result = strpbrk($haystack, $chars); |
| 695 | 695 | return is_string($result) ? $result : ''; |
| 696 | 696 | }; |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | * @param string $haystack |
| 710 | 710 | * @return string |
| 711 | 711 | */ |
| 712 | - return function (string $haystack) use ($char): string { |
|
| 712 | + return function(string $haystack) use ($char): string { |
|
| 713 | 713 | $result = strrchr($haystack, $char); |
| 714 | 714 | return is_string($result) ? $result : ''; |
| 715 | 715 | }; |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | * @param string $haystack |
| 729 | 729 | * @return string |
| 730 | 730 | */ |
| 731 | - return function (string $haystack) use ($dictionary): string { |
|
| 731 | + return function(string $haystack) use ($dictionary): string { |
|
| 732 | 732 | $result = strtr($haystack, $dictionary); |
| 733 | 733 | return $result; |
| 734 | 734 | }; |
@@ -758,7 +758,7 @@ discard block |
||
| 758 | 758 | * @param string|null $value |
| 759 | 759 | * @return Closure|string |
| 760 | 760 | */ |
| 761 | - return function (?string $value = null) use ($initial) { |
|
| 761 | + return function(?string $value = null) use ($initial) { |
|
| 762 | 762 | if ($value) { |
| 763 | 763 | $initial .= $value; |
| 764 | 764 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @param mixed The value passed into the functions |
| 50 | 50 | * @return mixed The final result. |
| 51 | 51 | */ |
| 52 | - return function ($e) use ($callables) { |
|
| 52 | + return function($e) use ($callables) { |
|
| 53 | 53 | foreach ($callables as $callable) { |
| 54 | 54 | $e = $callable($e); |
| 55 | 55 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @param mixed The value passed into the functions |
| 71 | 71 | * @return mixed The final result. |
| 72 | 72 | */ |
| 73 | - return function ($e) use ($callables) { |
|
| 73 | + return function($e) use ($callables) { |
|
| 74 | 74 | foreach (\array_reverse($callables) as $callable) { |
| 75 | 75 | $e = $callable($e); |
| 76 | 76 | } |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | * @param mixed The value passed into the functions |
| 92 | 92 | * @return mixed|null The final result or null. |
| 93 | 93 | */ |
| 94 | - return function ($e) use ($callables) { |
|
| 94 | + return function($e) use ($callables) { |
|
| 95 | 95 | foreach ($callables as $callable) { |
| 96 | - if (! is_null($e)) { |
|
| 96 | + if (!is_null($e)) { |
|
| 97 | 97 | $e = $callable($e); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -116,17 +116,17 @@ discard block |
||
| 116 | 116 | * @param mixed $e The value being passed through the functions. |
| 117 | 117 | * @return mixed The final result. |
| 118 | 118 | */ |
| 119 | - return function ($e) use ($validator, $callables) { |
|
| 119 | + return function($e) use ($validator, $callables) { |
|
| 120 | 120 | foreach ($callables as $callable) { |
| 121 | 121 | // If invalid, abort and return null |
| 122 | - if (! $validator($e)) { |
|
| 122 | + if (!$validator($e)) { |
|
| 123 | 123 | return null; |
| 124 | 124 | } |
| 125 | 125 | // Run through callable. |
| 126 | 126 | $e = $callable($e); |
| 127 | 127 | |
| 128 | 128 | // Check results and bail if invalid type. |
| 129 | - if (! $validator($e)) { |
|
| 129 | + if (!$validator($e)) { |
|
| 130 | 130 | return null; |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -172,9 +172,9 @@ discard block |
||
| 172 | 172 | * @param mixed $data The array or object to attempt to get param. |
| 173 | 173 | * @return mixed|null |
| 174 | 174 | */ |
| 175 | - return function ($data) use ($property) { |
|
| 175 | + return function($data) use ($property) { |
|
| 176 | 176 | if (is_array($data)) { |
| 177 | - return array_key_exists($property, $data) ? $data[ $property ] : null; |
|
| 177 | + return array_key_exists($property, $data) ? $data[$property] : null; |
|
| 178 | 178 | } elseif (is_object($data)) { |
| 179 | 179 | return property_exists($data, $property) ? $data->{$property} : null; |
| 180 | 180 | } else { |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @param mixed[]|object $data The array or object to attempt to get param. |
| 198 | 198 | * @return mixed|null |
| 199 | 199 | */ |
| 200 | - return function ($data) use ($nodes) { |
|
| 200 | + return function($data) use ($nodes) { |
|
| 201 | 201 | foreach ($nodes as $node) { |
| 202 | 202 | $data = getProperty($node)($data); |
| 203 | 203 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * @param mixed $data The array or object to attempt to get param. |
| 223 | 223 | * @return mixed|null |
| 224 | 224 | */ |
| 225 | - return function ($data) use ($property): bool { |
|
| 225 | + return function($data) use ($property): bool { |
|
| 226 | 226 | if (is_array($data)) { |
| 227 | 227 | return array_key_exists($property, $data); |
| 228 | 228 | } elseif (is_object($data)) { |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | * @param mixed $data The array or object to attempt to get param. |
| 248 | 248 | * @return bool |
| 249 | 249 | */ |
| 250 | - return function ($data) use ($property, $value): bool { |
|
| 250 | + return function($data) use ($property, $value): bool { |
|
| 251 | 251 | return pipe( |
| 252 | 252 | $data, |
| 253 | 253 | getProperty($property), |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | function setProperty($store, string $property): Closure |
| 272 | 272 | { |
| 273 | 273 | // If passed store is not an array or object, throw exception. |
| 274 | - if (! isArrayAccess($store) && ! is_object($store)) { |
|
| 274 | + if (!isArrayAccess($store) && !is_object($store)) { |
|
| 275 | 275 | throw new TypeError('Only objects or arrays can be constructed using setProperty.'); |
| 276 | 276 | } |
| 277 | 277 | |
@@ -279,10 +279,10 @@ discard block |
||
| 279 | 279 | * @param mixed $value The value to set to keu. |
| 280 | 280 | * @return array<string,mixed>|ArrayObject<string,mixed>|object The datastore. |
| 281 | 281 | */ |
| 282 | - return function ($value) use ($store, $property) { |
|
| 282 | + return function($value) use ($store, $property) { |
|
| 283 | 283 | if (isArrayAccess($store)) { |
| 284 | 284 | /** @phpstan-ignore-next-line */ |
| 285 | - $store[ $property ] = $value; |
|
| 285 | + $store[$property] = $value; |
|
| 286 | 286 | } else { |
| 287 | 287 | $store->{$property} = $value; |
| 288 | 288 | } |
@@ -305,8 +305,8 @@ discard block |
||
| 305 | 305 | * @param mixed $data The data to pass through the callable |
| 306 | 306 | * @return array |
| 307 | 307 | */ |
| 308 | - return function ($data) use ($key, $value): array { |
|
| 309 | - return array( $key => $value($data) ); |
|
| 308 | + return function($data) use ($key, $value): array { |
|
| 309 | + return array($key => $value($data)); |
|
| 310 | 310 | }; |
| 311 | 311 | } |
| 312 | 312 | |
@@ -323,12 +323,12 @@ discard block |
||
| 323 | 323 | * @param callable(mixed):mixed ...$encoders encodeProperty() functions. |
| 324 | 324 | * @return Closure |
| 325 | 325 | */ |
| 326 | - return function (...$encoders) use ($dataType): Closure { |
|
| 326 | + return function(...$encoders) use ($dataType): Closure { |
|
| 327 | 327 | /** |
| 328 | 328 | * @param mixed $data The data to pass through the encoders. |
| 329 | 329 | * @return array<string,mixed>|object The encoded object/array. |
| 330 | 330 | */ |
| 331 | - return function ($data) use ($dataType, $encoders) { |
|
| 331 | + return function($data) use ($dataType, $encoders) { |
|
| 332 | 332 | foreach ($encoders as $encoder) { |
| 333 | 333 | $key = array_keys($encoder($data))[0]; |
| 334 | 334 | // throw exception if key is int |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | * @param mixed ...$args |
| 356 | 356 | * @return mixed |
| 357 | 357 | */ |
| 358 | - return function (...$args) use ($fn) { |
|
| 358 | + return function(...$args) use ($fn) { |
|
| 359 | 359 | return $fn(...$args); |
| 360 | 360 | }; |
| 361 | 361 | } |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | * @param mixed $ignored Any values can be passed and ignored. |
| 373 | 373 | * @return mixed |
| 374 | 374 | */ |
| 375 | - return function (...$ignored) use ($value) { |
|
| 375 | + return function(...$ignored) use ($value) { |
|
| 376 | 376 | return $value; |
| 377 | 377 | }; |
| 378 | 378 | } |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | * @param mixed $value |
| 408 | 408 | * @return mixed |
| 409 | 409 | */ |
| 410 | - return function ($value) use ($condition, $then) { |
|
| 410 | + return function($value) use ($condition, $then) { |
|
| 411 | 411 | return true === (bool) $condition($value) |
| 412 | 412 | ? $then($value) |
| 413 | 413 | : $value; |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | * @param mixed $value |
| 431 | 431 | * @return mixed |
| 432 | 432 | */ |
| 433 | - return function ($value) use ($condition, $then, $else) { |
|
| 433 | + return function($value) use ($condition, $then, $else) { |
|
| 434 | 434 | return true === (bool) $condition($value) |
| 435 | 435 | ? $then($value) |
| 436 | 436 | : $else($value); |