@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | /** |
148 | 148 | * Get an item from an array using "dot" notation. |
149 | 149 | * |
150 | - * @param \ArrayAccess|array $array |
|
150 | + * @param Doctrine\DBAL\Schema\Index[] $array |
|
151 | 151 | * @param string $key |
152 | 152 | * @param mixed $default |
153 | 153 | * @return mixed |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | /** |
566 | 566 | * Escape HTML special characters in a string. |
567 | 567 | * |
568 | - * @param \Illuminate\Contracts\Support\Htmlable|string $value |
|
568 | + * @param string $value |
|
569 | 569 | * @param bool $doubleEncode |
570 | 570 | * @return string |
571 | 571 | */ |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | * Get the last element from an array. |
677 | 677 | * |
678 | 678 | * @param array $array |
679 | - * @return mixed |
|
679 | + * @return string |
|
680 | 680 | */ |
681 | 681 | function last($array) |
682 | 682 | { |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | * Determine if a given string contains a given substring. |
844 | 844 | * |
845 | 845 | * @param string $haystack |
846 | - * @param string|array $needles |
|
846 | + * @param string $needles |
|
847 | 847 | * @return bool |
848 | 848 | */ |
849 | 849 | function str_contains($haystack, $needles) |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | * |
1031 | 1031 | * @param mixed $value |
1032 | 1032 | * @param callable|null $callback |
1033 | - * @return mixed |
|
1033 | + * @return Illuminate\Database\Schema\Blueprint |
|
1034 | 1034 | */ |
1035 | 1035 | function tap($value, $callback = null) |
1036 | 1036 | { |
@@ -1168,7 +1168,7 @@ discard block |
||
1168 | 1168 | /** |
1169 | 1169 | * Return the given value, optionally passed through the given callback. |
1170 | 1170 | * |
1171 | - * @param mixed $value |
|
1171 | + * @param Psr\Log\LoggerInterface $value |
|
1172 | 1172 | * @param callable|null $callback |
1173 | 1173 | * @return mixed |
1174 | 1174 | */ |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | +use Illuminate\Contracts\Support\Htmlable; |
|
3 | 4 | use Illuminate\Support\Arr; |
4 | -use Illuminate\Support\Str; |
|
5 | -use Illuminate\Support\Optional; |
|
6 | 5 | use Illuminate\Support\Collection; |
7 | 6 | use Illuminate\Support\Debug\Dumper; |
8 | -use Illuminate\Contracts\Support\Htmlable; |
|
9 | 7 | use Illuminate\Support\HigherOrderTapProxy; |
8 | +use Illuminate\Support\Optional; |
|
9 | +use Illuminate\Support\Str; |
|
10 | 10 | |
11 | 11 | if (! function_exists('append_config')) { |
12 | 12 | /** |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | use Illuminate\Contracts\Support\Htmlable; |
9 | 9 | use Illuminate\Support\HigherOrderTapProxy; |
10 | 10 | |
11 | -if (! function_exists('append_config')) { |
|
11 | +if (!function_exists('append_config')) { |
|
12 | 12 | /** |
13 | 13 | * Assign high numeric IDs to a config item to force appending. |
14 | 14 | * |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | -if (! function_exists('array_add')) { |
|
34 | +if (!function_exists('array_add')) { |
|
35 | 35 | /** |
36 | 36 | * Add an element to an array using "dot" notation if it doesn't exist. |
37 | 37 | * |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | -if (! function_exists('array_collapse')) { |
|
49 | +if (!function_exists('array_collapse')) { |
|
50 | 50 | /** |
51 | 51 | * Collapse an array of arrays into a single array. |
52 | 52 | * |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | -if (! function_exists('array_divide')) { |
|
62 | +if (!function_exists('array_divide')) { |
|
63 | 63 | /** |
64 | 64 | * Divide an array into two arrays. One with keys and the other with values. |
65 | 65 | * |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | -if (! function_exists('array_dot')) { |
|
75 | +if (!function_exists('array_dot')) { |
|
76 | 76 | /** |
77 | 77 | * Flatten a multi-dimensional associative array with dots. |
78 | 78 | * |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | -if (! function_exists('array_except')) { |
|
89 | +if (!function_exists('array_except')) { |
|
90 | 90 | /** |
91 | 91 | * Get all of the given array except for a specified array of keys. |
92 | 92 | * |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | -if (! function_exists('array_first')) { |
|
103 | +if (!function_exists('array_first')) { |
|
104 | 104 | /** |
105 | 105 | * Return the first element in an array passing a given truth test. |
106 | 106 | * |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | -if (! function_exists('array_flatten')) { |
|
118 | +if (!function_exists('array_flatten')) { |
|
119 | 119 | /** |
120 | 120 | * Flatten a multi-dimensional array into a single level. |
121 | 121 | * |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
132 | -if (! function_exists('array_forget')) { |
|
132 | +if (!function_exists('array_forget')) { |
|
133 | 133 | /** |
134 | 134 | * Remove one or many array items from a given array using "dot" notation. |
135 | 135 | * |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | -if (! function_exists('array_get')) { |
|
146 | +if (!function_exists('array_get')) { |
|
147 | 147 | /** |
148 | 148 | * Get an item from an array using "dot" notation. |
149 | 149 | * |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | -if (! function_exists('array_has')) { |
|
161 | +if (!function_exists('array_has')) { |
|
162 | 162 | /** |
163 | 163 | * Check if an item or items exist in an array using "dot" notation. |
164 | 164 | * |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | -if (! function_exists('array_last')) { |
|
175 | +if (!function_exists('array_last')) { |
|
176 | 176 | /** |
177 | 177 | * Return the last element in an array passing a given truth test. |
178 | 178 | * |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
190 | -if (! function_exists('array_only')) { |
|
190 | +if (!function_exists('array_only')) { |
|
191 | 191 | /** |
192 | 192 | * Get a subset of the items from the given array. |
193 | 193 | * |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | -if (! function_exists('array_pluck')) { |
|
204 | +if (!function_exists('array_pluck')) { |
|
205 | 205 | /** |
206 | 206 | * Pluck an array of values from an array. |
207 | 207 | * |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | } |
218 | 218 | |
219 | -if (! function_exists('array_prepend')) { |
|
219 | +if (!function_exists('array_prepend')) { |
|
220 | 220 | /** |
221 | 221 | * Push an item onto the beginning of an array. |
222 | 222 | * |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | } |
232 | 232 | } |
233 | 233 | |
234 | -if (! function_exists('array_pull')) { |
|
234 | +if (!function_exists('array_pull')) { |
|
235 | 235 | /** |
236 | 236 | * Get a value from the array, and remove it. |
237 | 237 | * |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | } |
247 | 247 | } |
248 | 248 | |
249 | -if (! function_exists('array_random')) { |
|
249 | +if (!function_exists('array_random')) { |
|
250 | 250 | /** |
251 | 251 | * Get a random value from an array. |
252 | 252 | * |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | -if (! function_exists('array_set')) { |
|
263 | +if (!function_exists('array_set')) { |
|
264 | 264 | /** |
265 | 265 | * Set an array item to a given value using "dot" notation. |
266 | 266 | * |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | } |
278 | 278 | } |
279 | 279 | |
280 | -if (! function_exists('array_sort')) { |
|
280 | +if (!function_exists('array_sort')) { |
|
281 | 281 | /** |
282 | 282 | * Sort the array by the given callback or attribute name. |
283 | 283 | * |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
294 | -if (! function_exists('array_sort_recursive')) { |
|
294 | +if (!function_exists('array_sort_recursive')) { |
|
295 | 295 | /** |
296 | 296 | * Recursively sort an array by keys and values. |
297 | 297 | * |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | } |
305 | 305 | } |
306 | 306 | |
307 | -if (! function_exists('array_where')) { |
|
307 | +if (!function_exists('array_where')) { |
|
308 | 308 | /** |
309 | 309 | * Filter the array using the given callback. |
310 | 310 | * |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | } |
319 | 319 | } |
320 | 320 | |
321 | -if (! function_exists('array_wrap')) { |
|
321 | +if (!function_exists('array_wrap')) { |
|
322 | 322 | /** |
323 | 323 | * If the given value is not an array, wrap it in one. |
324 | 324 | * |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
334 | -if (! function_exists('blank')) { |
|
334 | +if (!function_exists('blank')) { |
|
335 | 335 | /** |
336 | 336 | * Determine if the given value is "blank". |
337 | 337 | * |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | } |
361 | 361 | } |
362 | 362 | |
363 | -if (! function_exists('camel_case')) { |
|
363 | +if (!function_exists('camel_case')) { |
|
364 | 364 | /** |
365 | 365 | * Convert a value to camel case. |
366 | 366 | * |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | } |
374 | 374 | } |
375 | 375 | |
376 | -if (! function_exists('class_basename')) { |
|
376 | +if (!function_exists('class_basename')) { |
|
377 | 377 | /** |
378 | 378 | * Get the class "basename" of the given object / class. |
379 | 379 | * |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | } |
389 | 389 | } |
390 | 390 | |
391 | -if (! function_exists('class_uses_recursive')) { |
|
391 | +if (!function_exists('class_uses_recursive')) { |
|
392 | 392 | /** |
393 | 393 | * Returns all traits used by a class, its parent classes and trait of their traits. |
394 | 394 | * |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | } |
412 | 412 | } |
413 | 413 | |
414 | -if (! function_exists('collect')) { |
|
414 | +if (!function_exists('collect')) { |
|
415 | 415 | /** |
416 | 416 | * Create a collection from the given value. |
417 | 417 | * |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | } |
425 | 425 | } |
426 | 426 | |
427 | -if (! function_exists('data_fill')) { |
|
427 | +if (!function_exists('data_fill')) { |
|
428 | 428 | /** |
429 | 429 | * Fill in data where it's missing. |
430 | 430 | * |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | } |
440 | 440 | } |
441 | 441 | |
442 | -if (! function_exists('data_get')) { |
|
442 | +if (!function_exists('data_get')) { |
|
443 | 443 | /** |
444 | 444 | * Get an item from an array or object using "dot" notation. |
445 | 445 | * |
@@ -456,11 +456,11 @@ discard block |
||
456 | 456 | |
457 | 457 | $key = is_array($key) ? $key : explode('.', $key); |
458 | 458 | |
459 | - while (! is_null($segment = array_shift($key))) { |
|
459 | + while (!is_null($segment = array_shift($key))) { |
|
460 | 460 | if ($segment === '*') { |
461 | 461 | if ($target instanceof Collection) { |
462 | 462 | $target = $target->all(); |
463 | - } elseif (! is_array($target)) { |
|
463 | + } elseif (!is_array($target)) { |
|
464 | 464 | return value($default); |
465 | 465 | } |
466 | 466 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | } |
483 | 483 | } |
484 | 484 | |
485 | -if (! function_exists('data_set')) { |
|
485 | +if (!function_exists('data_set')) { |
|
486 | 486 | /** |
487 | 487 | * Set an item on an array or object using dot notation. |
488 | 488 | * |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | $segments = is_array($key) ? $key : explode('.', $key); |
498 | 498 | |
499 | 499 | if (($segment = array_shift($segments)) === '*') { |
500 | - if (! Arr::accessible($target)) { |
|
500 | + if (!Arr::accessible($target)) { |
|
501 | 501 | $target = []; |
502 | 502 | } |
503 | 503 | |
@@ -512,22 +512,22 @@ discard block |
||
512 | 512 | } |
513 | 513 | } elseif (Arr::accessible($target)) { |
514 | 514 | if ($segments) { |
515 | - if (! Arr::exists($target, $segment)) { |
|
515 | + if (!Arr::exists($target, $segment)) { |
|
516 | 516 | $target[$segment] = []; |
517 | 517 | } |
518 | 518 | |
519 | 519 | data_set($target[$segment], $segments, $value, $overwrite); |
520 | - } elseif ($overwrite || ! Arr::exists($target, $segment)) { |
|
520 | + } elseif ($overwrite || !Arr::exists($target, $segment)) { |
|
521 | 521 | $target[$segment] = $value; |
522 | 522 | } |
523 | 523 | } elseif (is_object($target)) { |
524 | 524 | if ($segments) { |
525 | - if (! isset($target->{$segment})) { |
|
525 | + if (!isset($target->{$segment})) { |
|
526 | 526 | $target->{$segment} = []; |
527 | 527 | } |
528 | 528 | |
529 | 529 | data_set($target->{$segment}, $segments, $value, $overwrite); |
530 | - } elseif ($overwrite || ! isset($target->{$segment})) { |
|
530 | + } elseif ($overwrite || !isset($target->{$segment})) { |
|
531 | 531 | $target->{$segment} = $value; |
532 | 532 | } |
533 | 533 | } else { |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | } |
545 | 545 | } |
546 | 546 | |
547 | -if (! function_exists('dd')) { |
|
547 | +if (!function_exists('dd')) { |
|
548 | 548 | /** |
549 | 549 | * Dump the passed variables and end the script. |
550 | 550 | * |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | } |
562 | 562 | } |
563 | 563 | |
564 | -if (! function_exists('e')) { |
|
564 | +if (!function_exists('e')) { |
|
565 | 565 | /** |
566 | 566 | * Escape HTML special characters in a string. |
567 | 567 | * |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | } |
580 | 580 | } |
581 | 581 | |
582 | -if (! function_exists('ends_with')) { |
|
582 | +if (!function_exists('ends_with')) { |
|
583 | 583 | /** |
584 | 584 | * Determine if a given string ends with a given substring. |
585 | 585 | * |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | } |
594 | 594 | } |
595 | 595 | |
596 | -if (! function_exists('env')) { |
|
596 | +if (!function_exists('env')) { |
|
597 | 597 | /** |
598 | 598 | * Gets the value of an environment variable. |
599 | 599 | * |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | } |
633 | 633 | } |
634 | 634 | |
635 | -if (! function_exists('filled')) { |
|
635 | +if (!function_exists('filled')) { |
|
636 | 636 | /** |
637 | 637 | * Determine if a value is "filled". |
638 | 638 | * |
@@ -641,11 +641,11 @@ discard block |
||
641 | 641 | */ |
642 | 642 | function filled($value) |
643 | 643 | { |
644 | - return ! blank($value); |
|
644 | + return !blank($value); |
|
645 | 645 | } |
646 | 646 | } |
647 | 647 | |
648 | -if (! function_exists('head')) { |
|
648 | +if (!function_exists('head')) { |
|
649 | 649 | /** |
650 | 650 | * Get the first element of an array. Useful for method chaining. |
651 | 651 | * |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | } |
659 | 659 | } |
660 | 660 | |
661 | -if (! function_exists('kebab_case')) { |
|
661 | +if (!function_exists('kebab_case')) { |
|
662 | 662 | /** |
663 | 663 | * Convert a string to kebab case. |
664 | 664 | * |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | } |
672 | 672 | } |
673 | 673 | |
674 | -if (! function_exists('last')) { |
|
674 | +if (!function_exists('last')) { |
|
675 | 675 | /** |
676 | 676 | * Get the last element from an array. |
677 | 677 | * |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | } |
685 | 685 | } |
686 | 686 | |
687 | -if (! function_exists('object_get')) { |
|
687 | +if (!function_exists('object_get')) { |
|
688 | 688 | /** |
689 | 689 | * Get an item from an object using "dot" notation. |
690 | 690 | * |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | } |
701 | 701 | |
702 | 702 | foreach (explode('.', $key) as $segment) { |
703 | - if (! is_object($object) || ! isset($object->{$segment})) { |
|
703 | + if (!is_object($object) || !isset($object->{$segment})) { |
|
704 | 704 | return value($default); |
705 | 705 | } |
706 | 706 | |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | } |
712 | 712 | } |
713 | 713 | |
714 | -if (! function_exists('optional')) { |
|
714 | +if (!function_exists('optional')) { |
|
715 | 715 | /** |
716 | 716 | * Provide access to optional objects. |
717 | 717 | * |
@@ -723,13 +723,13 @@ discard block |
||
723 | 723 | { |
724 | 724 | if (is_null($callback)) { |
725 | 725 | return new Optional($value); |
726 | - } elseif (! is_null($value)) { |
|
726 | + } elseif (!is_null($value)) { |
|
727 | 727 | return $callback($value); |
728 | 728 | } |
729 | 729 | } |
730 | 730 | } |
731 | 731 | |
732 | -if (! function_exists('preg_replace_array')) { |
|
732 | +if (!function_exists('preg_replace_array')) { |
|
733 | 733 | /** |
734 | 734 | * Replace a given pattern with each value in the array in sequentially. |
735 | 735 | * |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | */ |
741 | 741 | function preg_replace_array($pattern, array $replacements, $subject) |
742 | 742 | { |
743 | - return preg_replace_callback($pattern, function () use (&$replacements) { |
|
743 | + return preg_replace_callback($pattern, function() use (&$replacements) { |
|
744 | 744 | foreach ($replacements as $key => $value) { |
745 | 745 | return array_shift($replacements); |
746 | 746 | } |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | } |
749 | 749 | } |
750 | 750 | |
751 | -if (! function_exists('retry')) { |
|
751 | +if (!function_exists('retry')) { |
|
752 | 752 | /** |
753 | 753 | * Retry an operation a given number of times. |
754 | 754 | * |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | try { |
768 | 768 | return $callback(); |
769 | 769 | } catch (Exception $e) { |
770 | - if (! $times) { |
|
770 | + if (!$times) { |
|
771 | 771 | throw $e; |
772 | 772 | } |
773 | 773 | |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | } |
783 | 783 | } |
784 | 784 | |
785 | -if (! function_exists('snake_case')) { |
|
785 | +if (!function_exists('snake_case')) { |
|
786 | 786 | /** |
787 | 787 | * Convert a string to snake case. |
788 | 788 | * |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | } |
797 | 797 | } |
798 | 798 | |
799 | -if (! function_exists('starts_with')) { |
|
799 | +if (!function_exists('starts_with')) { |
|
800 | 800 | /** |
801 | 801 | * Determine if a given string starts with a given substring. |
802 | 802 | * |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | } |
811 | 811 | } |
812 | 812 | |
813 | -if (! function_exists('str_after')) { |
|
813 | +if (!function_exists('str_after')) { |
|
814 | 814 | /** |
815 | 815 | * Return the remainder of a string after a given value. |
816 | 816 | * |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | } |
825 | 825 | } |
826 | 826 | |
827 | -if (! function_exists('str_before')) { |
|
827 | +if (!function_exists('str_before')) { |
|
828 | 828 | /** |
829 | 829 | * Get the portion of a string before a given value. |
830 | 830 | * |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | } |
839 | 839 | } |
840 | 840 | |
841 | -if (! function_exists('str_contains')) { |
|
841 | +if (!function_exists('str_contains')) { |
|
842 | 842 | /** |
843 | 843 | * Determine if a given string contains a given substring. |
844 | 844 | * |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | } |
853 | 853 | } |
854 | 854 | |
855 | -if (! function_exists('str_finish')) { |
|
855 | +if (!function_exists('str_finish')) { |
|
856 | 856 | /** |
857 | 857 | * Cap a string with a single instance of a given value. |
858 | 858 | * |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | } |
867 | 867 | } |
868 | 868 | |
869 | -if (! function_exists('str_is')) { |
|
869 | +if (!function_exists('str_is')) { |
|
870 | 870 | /** |
871 | 871 | * Determine if a given string matches a given pattern. |
872 | 872 | * |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | } |
881 | 881 | } |
882 | 882 | |
883 | -if (! function_exists('str_limit')) { |
|
883 | +if (!function_exists('str_limit')) { |
|
884 | 884 | /** |
885 | 885 | * Limit the number of characters in a string. |
886 | 886 | * |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | } |
896 | 896 | } |
897 | 897 | |
898 | -if (! function_exists('str_plural')) { |
|
898 | +if (!function_exists('str_plural')) { |
|
899 | 899 | /** |
900 | 900 | * Get the plural form of an English word. |
901 | 901 | * |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | } |
910 | 910 | } |
911 | 911 | |
912 | -if (! function_exists('str_random')) { |
|
912 | +if (!function_exists('str_random')) { |
|
913 | 913 | /** |
914 | 914 | * Generate a more truly "random" alpha-numeric string. |
915 | 915 | * |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | } |
925 | 925 | } |
926 | 926 | |
927 | -if (! function_exists('str_replace_array')) { |
|
927 | +if (!function_exists('str_replace_array')) { |
|
928 | 928 | /** |
929 | 929 | * Replace a given value in the string sequentially with an array. |
930 | 930 | * |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | } |
940 | 940 | } |
941 | 941 | |
942 | -if (! function_exists('str_replace_first')) { |
|
942 | +if (!function_exists('str_replace_first')) { |
|
943 | 943 | /** |
944 | 944 | * Replace the first occurrence of a given value in the string. |
945 | 945 | * |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | } |
955 | 955 | } |
956 | 956 | |
957 | -if (! function_exists('str_replace_last')) { |
|
957 | +if (!function_exists('str_replace_last')) { |
|
958 | 958 | /** |
959 | 959 | * Replace the last occurrence of a given value in the string. |
960 | 960 | * |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | } |
970 | 970 | } |
971 | 971 | |
972 | -if (! function_exists('str_singular')) { |
|
972 | +if (!function_exists('str_singular')) { |
|
973 | 973 | /** |
974 | 974 | * Get the singular form of an English word. |
975 | 975 | * |
@@ -982,7 +982,7 @@ discard block |
||
982 | 982 | } |
983 | 983 | } |
984 | 984 | |
985 | -if (! function_exists('str_slug')) { |
|
985 | +if (!function_exists('str_slug')) { |
|
986 | 986 | /** |
987 | 987 | * Generate a URL friendly "slug" from a given string. |
988 | 988 | * |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | } |
998 | 998 | } |
999 | 999 | |
1000 | -if (! function_exists('str_start')) { |
|
1000 | +if (!function_exists('str_start')) { |
|
1001 | 1001 | /** |
1002 | 1002 | * Begin a string with a single instance of a given value. |
1003 | 1003 | * |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | } |
1012 | 1012 | } |
1013 | 1013 | |
1014 | -if (! function_exists('studly_case')) { |
|
1014 | +if (!function_exists('studly_case')) { |
|
1015 | 1015 | /** |
1016 | 1016 | * Convert a value to studly caps case. |
1017 | 1017 | * |
@@ -1024,7 +1024,7 @@ discard block |
||
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | |
1027 | -if (! function_exists('tap')) { |
|
1027 | +if (!function_exists('tap')) { |
|
1028 | 1028 | /** |
1029 | 1029 | * Call the given Closure with the given value then return the value. |
1030 | 1030 | * |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | } |
1045 | 1045 | } |
1046 | 1046 | |
1047 | -if (! function_exists('throw_if')) { |
|
1047 | +if (!function_exists('throw_if')) { |
|
1048 | 1048 | /** |
1049 | 1049 | * Throw the given exception if the given condition is true. |
1050 | 1050 | * |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | } |
1065 | 1065 | } |
1066 | 1066 | |
1067 | -if (! function_exists('throw_unless')) { |
|
1067 | +if (!function_exists('throw_unless')) { |
|
1068 | 1068 | /** |
1069 | 1069 | * Throw the given exception unless the given condition is true. |
1070 | 1070 | * |
@@ -1076,7 +1076,7 @@ discard block |
||
1076 | 1076 | */ |
1077 | 1077 | function throw_unless($condition, $exception, ...$parameters) |
1078 | 1078 | { |
1079 | - if (! $condition) { |
|
1079 | + if (!$condition) { |
|
1080 | 1080 | throw (is_string($exception) ? new $exception(...$parameters) : $exception); |
1081 | 1081 | } |
1082 | 1082 | |
@@ -1084,7 +1084,7 @@ discard block |
||
1084 | 1084 | } |
1085 | 1085 | } |
1086 | 1086 | |
1087 | -if (! function_exists('title_case')) { |
|
1087 | +if (!function_exists('title_case')) { |
|
1088 | 1088 | /** |
1089 | 1089 | * Convert a value to title case. |
1090 | 1090 | * |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | } |
1098 | 1098 | } |
1099 | 1099 | |
1100 | -if (! function_exists('trait_uses_recursive')) { |
|
1100 | +if (!function_exists('trait_uses_recursive')) { |
|
1101 | 1101 | /** |
1102 | 1102 | * Returns all traits used by a trait and its traits. |
1103 | 1103 | * |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | } |
1117 | 1117 | } |
1118 | 1118 | |
1119 | -if (! function_exists('transform')) { |
|
1119 | +if (!function_exists('transform')) { |
|
1120 | 1120 | /** |
1121 | 1121 | * Transform the given value if it is present. |
1122 | 1122 | * |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | } |
1140 | 1140 | } |
1141 | 1141 | |
1142 | -if (! function_exists('value')) { |
|
1142 | +if (!function_exists('value')) { |
|
1143 | 1143 | /** |
1144 | 1144 | * Return the default value of the given value. |
1145 | 1145 | * |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | } |
1153 | 1153 | } |
1154 | 1154 | |
1155 | -if (! function_exists('windows_os')) { |
|
1155 | +if (!function_exists('windows_os')) { |
|
1156 | 1156 | /** |
1157 | 1157 | * Determine whether the current environment is Windows based. |
1158 | 1158 | * |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | } |
1165 | 1165 | } |
1166 | 1166 | |
1167 | -if (! function_exists('with')) { |
|
1167 | +if (!function_exists('with')) { |
|
1168 | 1168 | /** |
1169 | 1169 | * Return the given value, optionally passed through the given callback. |
1170 | 1170 | * |
@@ -740,7 +740,7 @@ |
||
740 | 740 | */ |
741 | 741 | function preg_replace_array($pattern, array $replacements, $subject) |
742 | 742 | { |
743 | - return preg_replace_callback($pattern, function () use (&$replacements) { |
|
743 | + return preg_replace_callback($pattern, function () use (&$replacements){ |
|
744 | 744 | foreach ($replacements as $key => $value) { |
745 | 745 | return array_shift($replacements); |
746 | 746 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | /** |
26 | 26 | * Get the "available at" UNIX timestamp. |
27 | 27 | * |
28 | - * @param \DateTimeInterface|\DateInterval|int $delay |
|
28 | + * @param integer $delay |
|
29 | 29 | * @return int |
30 | 30 | */ |
31 | 31 | protected function availableAt($delay = 0) |
@@ -3,11 +3,11 @@ |
||
3 | 3 | namespace Illuminate\Support; |
4 | 4 | |
5 | 5 | use Countable; |
6 | -use JsonSerializable; |
|
7 | -use Illuminate\Contracts\Support\Jsonable; |
|
8 | 6 | use Illuminate\Contracts\Support\Arrayable; |
9 | -use Illuminate\Contracts\Support\MessageProvider; |
|
7 | +use Illuminate\Contracts\Support\Jsonable; |
|
10 | 8 | use Illuminate\Contracts\Support\MessageBag as MessageBagContract; |
9 | +use Illuminate\Contracts\Support\MessageProvider; |
|
10 | +use JsonSerializable; |
|
11 | 11 | |
12 | 12 | class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, MessageBagContract, MessageProvider |
13 | 13 | { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $messages = (array) $this->messages; |
78 | 78 | |
79 | - return ! isset($messages[$key]) || ! in_array($message, $messages[$key]); |
|
79 | + return !isset($messages[$key]) || !in_array($message, $messages[$key]); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | protected function getMessagesForWildcardKey($key, $format) |
190 | 190 | { |
191 | 191 | return collect($this->messages) |
192 | - ->filter(function ($messages, $messageKey) use ($key) { |
|
192 | + ->filter(function($messages, $messageKey) use ($key) { |
|
193 | 193 | return Str::is($key, $messageKey); |
194 | 194 | }) |
195 | - ->map(function ($messages, $messageKey) use ($format) { |
|
195 | + ->map(function($messages, $messageKey) use ($format) { |
|
196 | 196 | return $this->transform( |
197 | 197 | $messages, $this->checkFormat($format), $messageKey |
198 | 198 | ); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | protected function transform($messages, $format, $messageKey) |
241 | 241 | { |
242 | 242 | return collect((array) $messages) |
243 | - ->map(function ($message) use ($format, $messageKey) { |
|
243 | + ->map(function($message) use ($format, $messageKey) { |
|
244 | 244 | // We will simply spin through the given messages and transform each one |
245 | 245 | // replacing the :message place holder with the real message allowing |
246 | 246 | // the messages to be easily formatted to each developer's desires. |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function isEmpty() |
321 | 321 | { |
322 | - return ! $this->any(); |
|
322 | + return !$this->any(); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | protected function getMessagesForWildcardKey($key, $format) |
190 | 190 | { |
191 | 191 | return collect($this->messages) |
192 | - ->filter(function ($messages, $messageKey) use ($key) { |
|
192 | + ->filter(function ($messages, $messageKey) use ($key){ |
|
193 | 193 | return Str::is($key, $messageKey); |
194 | 194 | }) |
195 | - ->map(function ($messages, $messageKey) use ($format) { |
|
195 | + ->map(function ($messages, $messageKey) use ($format){ |
|
196 | 196 | return $this->transform( |
197 | 197 | $messages, $this->checkFormat($format), $messageKey |
198 | 198 | ); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | protected function transform($messages, $format, $messageKey) |
241 | 241 | { |
242 | 242 | return collect((array) $messages) |
243 | - ->map(function ($message) use ($format, $messageKey) { |
|
243 | + ->map(function ($message) use ($format, $messageKey){ |
|
244 | 244 | // We will simply spin through the given messages and transform each one |
245 | 245 | // replacing the :message place holder with the real message allowing |
246 | 246 | // the messages to be easily formatted to each developer's desires. |
@@ -75,7 +75,7 @@ |
||
75 | 75 | /** |
76 | 76 | * Register a view file namespace. |
77 | 77 | * |
78 | - * @param string|array $path |
|
78 | + * @param string $path |
|
79 | 79 | * @param string $namespace |
80 | 80 | * @return void |
81 | 81 | */ |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | protected function loadRoutesFrom($path) |
69 | 69 | { |
70 | - if (! $this->app->routesAreCached()) { |
|
70 | + if (!$this->app->routesAreCached()) { |
|
71 | 71 | require $path; |
72 | 72 | } |
73 | 73 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | protected function loadMigrationsFrom($paths) |
125 | 125 | { |
126 | - $this->app->afterResolving('migrator', function ($migrator) use ($paths) { |
|
126 | + $this->app->afterResolving('migrator', function($migrator) use ($paths) { |
|
127 | 127 | foreach ((array) $paths as $path) { |
128 | 128 | $migrator->path($path); |
129 | 129 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | protected function ensurePublishArrayInitialized($class) |
158 | 158 | { |
159 | - if (! array_key_exists($class, static::$publishes)) { |
|
159 | + if (!array_key_exists($class, static::$publishes)) { |
|
160 | 160 | static::$publishes[$class] = []; |
161 | 161 | } |
162 | 162 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | protected function addPublishGroup($group, $paths) |
172 | 172 | { |
173 | - if (! array_key_exists($group, static::$publishGroups)) { |
|
173 | + if (!array_key_exists($group, static::$publishGroups)) { |
|
174 | 174 | static::$publishGroups[$group] = []; |
175 | 175 | } |
176 | 176 | |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public static function pathsToPublish($provider = null, $group = null) |
190 | 190 | { |
191 | - if (! is_null($paths = static::pathsForProviderOrGroup($provider, $group))) { |
|
191 | + if (!is_null($paths = static::pathsForProviderOrGroup($provider, $group))) { |
|
192 | 192 | return $paths; |
193 | 193 | } |
194 | 194 | |
195 | - return collect(static::$publishes)->reduce(function ($paths, $p) { |
|
195 | + return collect(static::$publishes)->reduce(function($paths, $p){ |
|
196 | 196 | return array_merge($paths, $p); |
197 | 197 | }, []); |
198 | 198 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | */ |
227 | 227 | protected static function pathsForProviderAndGroup($provider, $group) |
228 | 228 | { |
229 | - if (! empty(static::$publishes[$provider]) && ! empty(static::$publishGroups[$group])) { |
|
229 | + if (!empty(static::$publishes[$provider]) && !empty(static::$publishGroups[$group])) { |
|
230 | 230 | return array_intersect_key(static::$publishes[$provider], static::$publishGroups[$group]); |
231 | 231 | } |
232 | 232 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | { |
264 | 264 | $commands = is_array($commands) ? $commands : func_get_args(); |
265 | 265 | |
266 | - Artisan::starting(function ($artisan) use ($commands) { |
|
266 | + Artisan::starting(function($artisan) use ($commands) { |
|
267 | 267 | $artisan->resolveCommands($commands); |
268 | 268 | }); |
269 | 269 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | protected function loadMigrationsFrom($paths) |
125 | 125 | { |
126 | - $this->app->afterResolving('migrator', function ($migrator) use ($paths) { |
|
126 | + $this->app->afterResolving('migrator', function ($migrator) use ($paths){ |
|
127 | 127 | foreach ((array) $paths as $path) { |
128 | 128 | $migrator->path($path); |
129 | 129 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | return $paths; |
193 | 193 | } |
194 | 194 | |
195 | - return collect(static::$publishes)->reduce(function ($paths, $p) { |
|
195 | + return collect(static::$publishes)->reduce(function ($paths, $p){ |
|
196 | 196 | return array_merge($paths, $p); |
197 | 197 | }, []); |
198 | 198 | } |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | { |
264 | 264 | $commands = is_array($commands) ? $commands : func_get_args(); |
265 | 265 | |
266 | - Artisan::starting(function ($artisan) use ($commands) { |
|
266 | + Artisan::starting(function ($artisan) use ($commands){ |
|
267 | 267 | $artisan->resolveCommands($commands); |
268 | 268 | }); |
269 | 269 | } |
@@ -2,11 +2,11 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Support; |
4 | 4 | |
5 | -use Ramsey\Uuid\Uuid; |
|
6 | -use Ramsey\Uuid\UuidFactory; |
|
7 | 5 | use Illuminate\Support\Traits\Macroable; |
8 | -use Ramsey\Uuid\Generator\CombGenerator; |
|
9 | 6 | use Ramsey\Uuid\Codec\TimestampFirstCombCodec; |
7 | +use Ramsey\Uuid\Generator\CombGenerator; |
|
8 | +use Ramsey\Uuid\Uuid; |
|
9 | +use Ramsey\Uuid\UuidFactory; |
|
10 | 10 | |
11 | 11 | class Str |
12 | 12 | { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | { |
57 | 57 | $languageSpecific = static::languageSpecificCharsArray($language); |
58 | 58 | |
59 | - if (! is_null($languageSpecific)) { |
|
59 | + if (!is_null($languageSpecific)) { |
|
60 | 60 | $value = str_replace($languageSpecific[0], $languageSpecific[1], $value); |
61 | 61 | } |
62 | 62 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | { |
250 | 250 | preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $value, $matches); |
251 | 251 | |
252 | - if (! isset($matches[0]) || static::length($value) === static::length($matches[0])) { |
|
252 | + if (!isset($matches[0]) || static::length($value) === static::length($matches[0])) { |
|
253 | 253 | return $value; |
254 | 254 | } |
255 | 255 | |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | return static::$snakeCache[$key][$delimiter]; |
452 | 452 | } |
453 | 453 | |
454 | - if (! ctype_lower($value)) { |
|
454 | + if (!ctype_lower($value)) { |
|
455 | 455 | $value = preg_replace('/\s+/u', '', ucwords($value)); |
456 | 456 | |
457 | 457 | $value = static::lower(preg_replace('/(.)(?=[A-Z])/u', '$1'.$delimiter, $value)); |
@@ -700,14 +700,14 @@ discard block |
||
700 | 700 | { |
701 | 701 | static $languageSpecific; |
702 | 702 | |
703 | - if (! isset($languageSpecific)) { |
|
703 | + if (!isset($languageSpecific)) { |
|
704 | 704 | $languageSpecific = [ |
705 | 705 | 'bg' => [ |
706 | 706 | ['х', 'Х', 'щ', 'Щ', 'ъ', 'Ъ', 'ь', 'Ь'], |
707 | 707 | ['h', 'H', 'sht', 'SHT', 'a', 'А', 'y', 'Y'], |
708 | 708 | ], |
709 | 709 | 'de' => [ |
710 | - ['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü'], |
|
710 | + ['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü'], |
|
711 | 711 | ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'], |
712 | 712 | ], |
713 | 713 | ]; |
@@ -145,7 +145,7 @@ |
||
145 | 145 | * Retrieve the handler for a command. |
146 | 146 | * |
147 | 147 | * @param mixed $command |
148 | - * @return mixed |
|
148 | + * @return boolean |
|
149 | 149 | */ |
150 | 150 | public function getCommandHandler($command) |
151 | 151 | { |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function dispatched($command, $callback = null) |
74 | 74 | { |
75 | - if (! $this->hasDispatched($command)) { |
|
75 | + if (!$this->hasDispatched($command)) { |
|
76 | 76 | return collect(); |
77 | 77 | } |
78 | 78 | |
79 | - $callback = $callback ?: function () { |
|
79 | + $callback = $callback ?: function(){ |
|
80 | 80 | return true; |
81 | 81 | }; |
82 | 82 | |
83 | - return collect($this->commands[$command])->filter(function ($command) use ($callback) { |
|
83 | + return collect($this->commands[$command])->filter(function($command) use ($callback) { |
|
84 | 84 | return $callback($command); |
85 | 85 | }); |
86 | 86 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function hasDispatched($command) |
95 | 95 | { |
96 | - return isset($this->commands[$command]) && ! empty($this->commands[$command]); |
|
96 | + return isset($this->commands[$command]) && !empty($this->commands[$command]); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -76,11 +76,11 @@ |
||
76 | 76 | return collect(); |
77 | 77 | } |
78 | 78 | |
79 | - $callback = $callback ?: function () { |
|
79 | + $callback = $callback ?: function (){ |
|
80 | 80 | return true; |
81 | 81 | }; |
82 | 82 | |
83 | - return collect($this->commands[$command])->filter(function ($command) use ($callback) { |
|
83 | + return collect($this->commands[$command])->filter(function ($command) use ($callback){ |
|
84 | 84 | return $callback($command); |
85 | 85 | }); |
86 | 86 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * |
36 | 36 | * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher |
37 | 37 | * @param array|string $eventsToFake |
38 | - * @return void |
|
38 | + * @return Dispatcher |
|
39 | 39 | */ |
40 | 40 | public function __construct(Dispatcher $dispatcher, $eventsToFake = []) |
41 | 41 | { |
@@ -3,9 +3,9 @@ |
||
3 | 3 | namespace Illuminate\Support\Testing\Fakes; |
4 | 4 | |
5 | 5 | use Closure; |
6 | +use Illuminate\Contracts\Events\Dispatcher; |
|
6 | 7 | use Illuminate\Support\Arr; |
7 | 8 | use PHPUnit\Framework\Assert as PHPUnit; |
8 | -use Illuminate\Contracts\Events\Dispatcher; |
|
9 | 9 | |
10 | 10 | class EventFake implements Dispatcher |
11 | 11 | { |
@@ -102,15 +102,15 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function dispatched($event, $callback = null) |
104 | 104 | { |
105 | - if (! $this->hasDispatched($event)) { |
|
105 | + if (!$this->hasDispatched($event)) { |
|
106 | 106 | return collect(); |
107 | 107 | } |
108 | 108 | |
109 | - $callback = $callback ?: function () { |
|
109 | + $callback = $callback ?: function(){ |
|
110 | 110 | return true; |
111 | 111 | }; |
112 | 112 | |
113 | - return collect($this->events[$event])->filter(function ($arguments) use ($callback) { |
|
113 | + return collect($this->events[$event])->filter(function($arguments) use ($callback) { |
|
114 | 114 | return $callback(...$arguments); |
115 | 115 | }); |
116 | 116 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function hasDispatched($event) |
125 | 125 | { |
126 | - return isset($this->events[$event]) && ! empty($this->events[$event]); |
|
126 | + return isset($this->events[$event]) && !empty($this->events[$event]); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | return collect($this->eventsToFake) |
232 | - ->filter(function ($event) use ($eventName, $payload) { |
|
232 | + ->filter(function($event) use ($eventName, $payload) { |
|
233 | 233 | return $event instanceof Closure |
234 | 234 | ? $event($eventName, $payload) |
235 | 235 | : $event === $eventName; |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | return collect(); |
107 | 107 | } |
108 | 108 | |
109 | - $callback = $callback ?: function () { |
|
109 | + $callback = $callback ?: function (){ |
|
110 | 110 | return true; |
111 | 111 | }; |
112 | 112 | |
113 | - return collect($this->events[$event])->filter(function ($arguments) use ($callback) { |
|
113 | + return collect($this->events[$event])->filter(function ($arguments) use ($callback){ |
|
114 | 114 | return $callback(...$arguments); |
115 | 115 | }); |
116 | 116 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | return collect($this->eventsToFake) |
232 | - ->filter(function ($event) use ($eventName, $payload) { |
|
232 | + ->filter(function ($event) use ($eventName, $payload){ |
|
233 | 233 | return $event instanceof Closure |
234 | 234 | ? $event($eventName, $payload) |
235 | 235 | : $event === $eventName; |
@@ -2,10 +2,10 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Support\Testing\Fakes; |
4 | 4 | |
5 | -use Illuminate\Contracts\Mail\Mailer; |
|
6 | 5 | use Illuminate\Contracts\Mail\Mailable; |
7 | -use PHPUnit\Framework\Assert as PHPUnit; |
|
6 | +use Illuminate\Contracts\Mail\Mailer; |
|
8 | 7 | use Illuminate\Contracts\Queue\ShouldQueue; |
8 | +use PHPUnit\Framework\Assert as PHPUnit; |
|
9 | 9 | |
10 | 10 | class MailFake implements Mailer |
11 | 11 | { |
@@ -156,15 +156,15 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function sent($mailable, $callback = null) |
158 | 158 | { |
159 | - if (! $this->hasSent($mailable)) { |
|
159 | + if (!$this->hasSent($mailable)) { |
|
160 | 160 | return collect(); |
161 | 161 | } |
162 | 162 | |
163 | - $callback = $callback ?: function () { |
|
163 | + $callback = $callback ?: function(){ |
|
164 | 164 | return true; |
165 | 165 | }; |
166 | 166 | |
167 | - return $this->mailablesOf($mailable)->filter(function ($mailable) use ($callback) { |
|
167 | + return $this->mailablesOf($mailable)->filter(function($mailable) use ($callback) { |
|
168 | 168 | return $callback($mailable); |
169 | 169 | }); |
170 | 170 | } |
@@ -189,15 +189,15 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function queued($mailable, $callback = null) |
191 | 191 | { |
192 | - if (! $this->hasQueued($mailable)) { |
|
192 | + if (!$this->hasQueued($mailable)) { |
|
193 | 193 | return collect(); |
194 | 194 | } |
195 | 195 | |
196 | - $callback = $callback ?: function () { |
|
196 | + $callback = $callback ?: function(){ |
|
197 | 197 | return true; |
198 | 198 | }; |
199 | 199 | |
200 | - return $this->queuedMailablesOf($mailable)->filter(function ($mailable) use ($callback) { |
|
200 | + return $this->queuedMailablesOf($mailable)->filter(function($mailable) use ($callback) { |
|
201 | 201 | return $callback($mailable); |
202 | 202 | }); |
203 | 203 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | protected function mailablesOf($type) |
223 | 223 | { |
224 | - return collect($this->mailables)->filter(function ($mailable) use ($type) { |
|
224 | + return collect($this->mailables)->filter(function($mailable) use ($type) { |
|
225 | 225 | return $mailable instanceof $type; |
226 | 226 | }); |
227 | 227 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | */ |
235 | 235 | protected function queuedMailablesOf($type) |
236 | 236 | { |
237 | - return collect($this->queuedMailables)->filter(function ($mailable) use ($type) { |
|
237 | + return collect($this->queuedMailables)->filter(function($mailable) use ($type) { |
|
238 | 238 | return $mailable instanceof $type; |
239 | 239 | }); |
240 | 240 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | */ |
284 | 284 | public function send($view, array $data = [], $callback = null) |
285 | 285 | { |
286 | - if (! $view instanceof Mailable) { |
|
286 | + if (!$view instanceof Mailable) { |
|
287 | 287 | return; |
288 | 288 | } |
289 | 289 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | */ |
304 | 304 | public function queue($view, $queue = null) |
305 | 305 | { |
306 | - if (! $view instanceof Mailable) { |
|
306 | + if (!$view instanceof Mailable) { |
|
307 | 307 | return; |
308 | 308 | } |
309 | 309 |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | return collect(); |
161 | 161 | } |
162 | 162 | |
163 | - $callback = $callback ?: function () { |
|
163 | + $callback = $callback ?: function (){ |
|
164 | 164 | return true; |
165 | 165 | }; |
166 | 166 | |
167 | - return $this->mailablesOf($mailable)->filter(function ($mailable) use ($callback) { |
|
167 | + return $this->mailablesOf($mailable)->filter(function ($mailable) use ($callback){ |
|
168 | 168 | return $callback($mailable); |
169 | 169 | }); |
170 | 170 | } |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | return collect(); |
194 | 194 | } |
195 | 195 | |
196 | - $callback = $callback ?: function () { |
|
196 | + $callback = $callback ?: function (){ |
|
197 | 197 | return true; |
198 | 198 | }; |
199 | 199 | |
200 | - return $this->queuedMailablesOf($mailable)->filter(function ($mailable) use ($callback) { |
|
200 | + return $this->queuedMailablesOf($mailable)->filter(function ($mailable) use ($callback){ |
|
201 | 201 | return $callback($mailable); |
202 | 202 | }); |
203 | 203 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | protected function mailablesOf($type) |
223 | 223 | { |
224 | - return collect($this->mailables)->filter(function ($mailable) use ($type) { |
|
224 | + return collect($this->mailables)->filter(function ($mailable) use ($type){ |
|
225 | 225 | return $mailable instanceof $type; |
226 | 226 | }); |
227 | 227 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | */ |
235 | 235 | protected function queuedMailablesOf($type) |
236 | 236 | { |
237 | - return collect($this->queuedMailables)->filter(function ($mailable) use ($type) { |
|
237 | + return collect($this->queuedMailables)->filter(function ($mailable) use ($type){ |
|
238 | 238 | return $mailable instanceof $type; |
239 | 239 | }); |
240 | 240 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | * Assert if a job was pushed based on a truth-test callback. |
20 | 20 | * |
21 | 21 | * @param string $job |
22 | - * @param callable|int|null $callback |
|
22 | + * @param \Closure $callback |
|
23 | 23 | * @return void |
24 | 24 | */ |
25 | 25 | public function assertPushed($job, $callback = null) |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Support\Testing\Fakes; |
4 | 4 | |
5 | -use Illuminate\Queue\QueueManager; |
|
6 | 5 | use Illuminate\Contracts\Queue\Queue; |
6 | +use Illuminate\Queue\QueueManager; |
|
7 | 7 | use PHPUnit\Framework\Assert as PHPUnit; |
8 | 8 | |
9 | 9 | class QueueFake extends QueueManager implements Queue |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function assertPushedOn($queue, $job, $callback = null) |
61 | 61 | { |
62 | - return $this->assertPushed($job, function ($job, $pushedQueue) use ($callback, $queue) { |
|
62 | + return $this->assertPushed($job, function($job, $pushedQueue) use ($callback, $queue) { |
|
63 | 63 | if ($pushedQueue !== $queue) { |
64 | 64 | return false; |
65 | 65 | } |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | */ |
104 | 104 | protected function assertPushedWithChainOfObjects($job, $expectedChain, $callback) |
105 | 105 | { |
106 | - $chain = collect($expectedChain)->map(function ($job) { |
|
106 | + $chain = collect($expectedChain)->map(function($job){ |
|
107 | 107 | return serialize($job); |
108 | 108 | })->all(); |
109 | 109 | |
110 | 110 | PHPUnit::assertTrue( |
111 | - $this->pushed($job, $callback)->filter(function ($job) use ($chain) { |
|
111 | + $this->pushed($job, $callback)->filter(function($job) use ($chain) { |
|
112 | 112 | return $job->chained == $chain; |
113 | 113 | })->isNotEmpty(), |
114 | 114 | 'The expected chain was not pushed.' |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | */ |
126 | 126 | protected function assertPushedWithChainOfClasses($job, $expectedChain, $callback) |
127 | 127 | { |
128 | - $matching = $this->pushed($job, $callback)->map->chained->map(function ($chain) { |
|
129 | - return collect($chain)->map(function ($job) { |
|
128 | + $matching = $this->pushed($job, $callback)->map->chained->map(function($chain){ |
|
129 | + return collect($chain)->map(function($job){ |
|
130 | 130 | return get_class(unserialize($job)); |
131 | 131 | }); |
132 | - })->filter(function ($chain) use ($expectedChain) { |
|
132 | + })->filter(function($chain) use ($expectedChain) { |
|
133 | 133 | return $chain->all() === $expectedChain; |
134 | 134 | }); |
135 | 135 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | protected function isChainOfObjects($chain) |
148 | 148 | { |
149 | 149 | return collect($chain)->count() == collect($chain) |
150 | - ->filter(function ($job) { |
|
150 | + ->filter(function($job){ |
|
151 | 151 | return is_object($job); |
152 | 152 | })->count(); |
153 | 153 | } |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function pushed($job, $callback = null) |
188 | 188 | { |
189 | - if (! $this->hasPushed($job)) { |
|
189 | + if (!$this->hasPushed($job)) { |
|
190 | 190 | return collect(); |
191 | 191 | } |
192 | 192 | |
193 | - $callback = $callback ?: function () { |
|
193 | + $callback = $callback ?: function(){ |
|
194 | 194 | return true; |
195 | 195 | }; |
196 | 196 | |
197 | - return collect($this->jobs[$job])->filter(function ($data) use ($callback) { |
|
197 | + return collect($this->jobs[$job])->filter(function($data) use ($callback) { |
|
198 | 198 | return $callback($data['job'], $data['queue']); |
199 | 199 | })->pluck('job'); |
200 | 200 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function hasPushed($job) |
209 | 209 | { |
210 | - return isset($this->jobs[$job]) && ! empty($this->jobs[$job]); |
|
210 | + return isset($this->jobs[$job]) && !empty($this->jobs[$job]); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function assertPushedOn($queue, $job, $callback = null) |
61 | 61 | { |
62 | - return $this->assertPushed($job, function ($job, $pushedQueue) use ($callback, $queue) { |
|
62 | + return $this->assertPushed($job, function ($job, $pushedQueue) use ($callback, $queue){ |
|
63 | 63 | if ($pushedQueue !== $queue) { |
64 | 64 | return false; |
65 | 65 | } |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | */ |
104 | 104 | protected function assertPushedWithChainOfObjects($job, $expectedChain, $callback) |
105 | 105 | { |
106 | - $chain = collect($expectedChain)->map(function ($job) { |
|
106 | + $chain = collect($expectedChain)->map(function ($job){ |
|
107 | 107 | return serialize($job); |
108 | 108 | })->all(); |
109 | 109 | |
110 | 110 | PHPUnit::assertTrue( |
111 | - $this->pushed($job, $callback)->filter(function ($job) use ($chain) { |
|
111 | + $this->pushed($job, $callback)->filter(function ($job) use ($chain){ |
|
112 | 112 | return $job->chained == $chain; |
113 | 113 | })->isNotEmpty(), |
114 | 114 | 'The expected chain was not pushed.' |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | */ |
126 | 126 | protected function assertPushedWithChainOfClasses($job, $expectedChain, $callback) |
127 | 127 | { |
128 | - $matching = $this->pushed($job, $callback)->map->chained->map(function ($chain) { |
|
129 | - return collect($chain)->map(function ($job) { |
|
128 | + $matching = $this->pushed($job, $callback)->map->chained->map(function ($chain){ |
|
129 | + return collect($chain)->map(function ($job){ |
|
130 | 130 | return get_class(unserialize($job)); |
131 | 131 | }); |
132 | - })->filter(function ($chain) use ($expectedChain) { |
|
132 | + })->filter(function ($chain) use ($expectedChain){ |
|
133 | 133 | return $chain->all() === $expectedChain; |
134 | 134 | }); |
135 | 135 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | protected function isChainOfObjects($chain) |
148 | 148 | { |
149 | 149 | return collect($chain)->count() == collect($chain) |
150 | - ->filter(function ($job) { |
|
150 | + ->filter(function ($job){ |
|
151 | 151 | return is_object($job); |
152 | 152 | })->count(); |
153 | 153 | } |
@@ -190,11 +190,11 @@ discard block |
||
190 | 190 | return collect(); |
191 | 191 | } |
192 | 192 | |
193 | - $callback = $callback ?: function () { |
|
193 | + $callback = $callback ?: function (){ |
|
194 | 194 | return true; |
195 | 195 | }; |
196 | 196 | |
197 | - return collect($this->jobs[$job])->filter(function ($data) use ($callback) { |
|
197 | + return collect($this->jobs[$job])->filter(function ($data) use ($callback){ |
|
198 | 198 | return $callback($data['job'], $data['queue']); |
199 | 199 | })->pluck('job'); |
200 | 200 | } |