Completed
Pull Request — master (#3873)
by jxlwqq
10:46
created
src/Grid/Tools/QuickCreate.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -34,6 +34,9 @@
 block discarded – undo
34 34
         $this->fields = Collection::make();
35 35
     }
36 36
 
37
+    /**
38
+     * @param string $placeholder
39
+     */
37 40
     protected function formatPlaceholder($placeholder)
38 41
     {
39 42
         return array_filter((array) $placeholder);
Please login to merge, or discard this patch.
src/Grid/Concerns/HasActions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
     /**
25 25
      * Set grid action callback.
26 26
      *
27
-     * @param Closure|string $actions
27
+     * @param Closure $actions
28 28
      *
29 29
      * @return $this
30 30
      */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@
 block discarded – undo
88 88
      */
89 89
     public function batchActions(Closure $closure)
90 90
     {
91
-        $this->tools(function (Grid\Tools $tools) use ($closure) {
91
+        $this->tools(function(Grid\Tools $tools) use ($closure) {
92 92
             $tools->batch($closure);
93 93
         });
94 94
 
Please login to merge, or discard this patch.
src/Grid.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
         $column = new Column($column, $label);
358 358
         $column->setGrid($this);
359 359
 
360
-        return tap($column, function ($value) {
360
+        return tap($column, function($value) {
361 361
             $this->columns->push($value);
362 362
         });
363 363
     }
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
         $column = new Column($column, $label);
422 422
         $column->setGrid($this);
423 423
 
424
-        return tap($column, function ($value) {
424
+        return tap($column, function($value) {
425 425
             $this->columns->prepend($value);
426 426
         });
427 427
     }
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 
555 555
         $data = $collection->toArray();
556 556
 
557
-        $this->columns->map(function (Column $column) use (&$data) {
557
+        $this->columns->map(function(Column $column) use (&$data) {
558 558
             $data = $column->fill($data);
559 559
 
560 560
             $this->columnNames[] = $column->getName();
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
      */
575 575
     protected function buildRows(array $data)
576 576
     {
577
-        $this->rows = collect($data)->map(function ($model, $number) {
577
+        $this->rows = collect($data)->map(function($model, $number) {
578 578
             return new Row($number, $model, $this->keyName);
579 579
         });
580 580
 
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
      * Get or set option for grid.
270 270
      *
271 271
      * @param string $key
272
-     * @param mixed  $value
272
+     * @param boolean  $value
273 273
      *
274 274
      * @return $this|mixed
275 275
      */
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
     /**
455 455
      * Get the grid paginator.
456 456
      *
457
-     * @return mixed
457
+     * @return Tools\Paginator
458 458
      */
459 459
     public function paginator()
460 460
     {
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
     }
533 533
 
534 534
     /**
535
-     * @return array|Collection|mixed
535
+     * @return Collection
536 536
      */
537 537
     protected function applyQuery()
538 538
     {
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
     /**
830 830
      * Dynamically add columns to the grid view.
831 831
      *
832
-     * @param $method
832
+     * @param string $method
833 833
      * @param $arguments
834 834
      *
835 835
      * @return Column
Please login to merge, or discard this patch.
src/Grid/Column.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     /**
219 219
      * Set model for column.
220 220
      *
221
-     * @param $model
221
+     * @param BaseModel $model
222 222
      */
223 223
     public function setModel($model)
224 224
     {
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
     /**
348 348
      * Get name of this column.
349 349
      *
350
-     * @return mixed
350
+     * @return string
351 351
      */
352 352
     public function getName()
353 353
     {
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
     /**
386 386
      * Get label of the column.
387 387
      *
388
-     * @return mixed
388
+     * @return string
389 389
      */
390 390
     public function getLabel()
391 391
     {
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 
498 498
         $column = $this;
499 499
 
500
-        return $this->display(function ($value) use ($grid, $column, $abstract, $arguments) {
500
+        return $this->display(function($value) use ($grid, $column, $abstract, $arguments) {
501 501
             /** @var AbstractDisplayer $displayer */
502 502
             $displayer = new $abstract($value, $grid, $column, $this);
503 503
 
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
      */
516 516
     public function using(array $values, $default = null)
517 517
     {
518
-        return $this->display(function ($value) use ($values, $default) {
518
+        return $this->display(function($value) use ($values, $default) {
519 519
             if (is_null($value)) {
520 520
                 return $default;
521 521
             }
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
      */
534 534
     public function replace(array $replacements)
535 535
     {
536
-        return $this->display(function ($value) use ($replacements) {
536
+        return $this->display(function($value) use ($replacements) {
537 537
             if (isset($replacements[$value])) {
538 538
                 return $replacements[$value];
539 539
             }
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
      */
552 552
     public function view($view)
553 553
     {
554
-        return $this->display(function ($value) use ($view) {
554
+        return $this->display(function($value) use ($view) {
555 555
             $model = $this;
556 556
 
557 557
             return view($view, compact('model', 'value'))->render();
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
      */
592 592
     public function filesize()
593 593
     {
594
-        return $this->display(function ($value) {
594
+        return $this->display(function($value) {
595 595
             return file_size($value);
596 596
         });
597 597
     }
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
      */
606 606
     public function gravatar($size = 30)
607 607
     {
608
-        return $this->display(function ($value) use ($size) {
608
+        return $this->display(function($value) use ($size) {
609 609
             $src = sprintf(
610 610
                 'https://www.gravatar.com/avatar/%s?s=%d',
611 611
                 md5(strtolower($value)),
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
      */
627 627
     public function loading($values = [], $others = [])
628 628
     {
629
-        return $this->display(function ($value) use ($values, $others) {
629
+        return $this->display(function($value) use ($values, $others) {
630 630
             $values = (array) $values;
631 631
 
632 632
             if (in_array($value, $values)) {
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
      */
648 648
     public function icon(array $setting, $default = '')
649 649
     {
650
-        return $this->display(function ($value) use ($setting, $default) {
650
+        return $this->display(function($value) use ($setting, $default) {
651 651
             $fa = '';
652 652
 
653 653
             if (isset($setting[$value])) {
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
             Carbon::setLocale($locale);
674 674
         }
675 675
 
676
-        return $this->display(function ($value) {
676
+        return $this->display(function($value) {
677 677
             return Carbon::parse($value)->diffForHumans();
678 678
         });
679 679
     }
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
      */
688 688
     public function date($format)
689 689
     {
690
-        return $this->display(function ($value) use ($format) {
690
+        return $this->display(function($value) use ($format) {
691 691
             return date($format, strtotime($value));
692 692
         });
693 693
     }
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
      */
703 703
     public function bool(array $map = [], $default = false)
704 704
     {
705
-        return $this->display(function ($value) use ($map, $default) {
705
+        return $this->display(function($value) use ($map, $default) {
706 706
             $bool = empty($map) ? boolval($value) : Arr::get($map, $value, $default);
707 707
 
708 708
             return $bool ? '<i class="fa fa-check text-green"></i>' : '<i class="fa fa-close text-red"></i>';
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 
725 725
         $grid = $this->grid;
726 726
 
727
-        return $this->display(function ($_, $column) use ($action, $grid) {
727
+        return $this->display(function($_, $column) use ($action, $grid) {
728 728
             /** @var RowAction $action */
729 729
             $action = new $action();
730 730
 
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
      */
747 747
     public function dot($options = [], $default = '')
748 748
     {
749
-        return $this->prefix(function ($_, $original) use ($options, $default) {
749
+        return $this->prefix(function($_, $original) use ($options, $default) {
750 750
             if (is_null($original)) {
751 751
                 $style = $default;
752 752
             } else {
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
         $grid = $this->grid;
874 874
         $column = $this;
875 875
 
876
-        $this->display(function ($value) use ($grid, $column, $class) {
876
+        $this->display(function($value) use ($grid, $column, $class) {
877 877
             /** @var AbstractDisplayer $definition */
878 878
             $definition = new $class($value, $grid, $column, $this);
879 879
 
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
     protected function htmlEntityEncode($item)
892 892
     {
893 893
         if (is_array($item)) {
894
-            array_walk_recursive($item, function (&$value) {
894
+            array_walk_recursive($item, function(&$value) {
895 895
                 $value = htmlentities($value);
896 896
             });
897 897
         } else {
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
      */
929 929
     protected function callSupportDisplayer($abstract, $arguments)
930 930
     {
931
-        return $this->display(function ($value) use ($abstract, $arguments) {
931
+        return $this->display(function($value) use ($abstract, $arguments) {
932 932
             if (is_array($value) || $value instanceof Arrayable) {
933 933
                 return call_user_func_array([collect($value), $abstract], $arguments);
934 934
             }
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
     protected function callBuiltinDisplayer($abstract, $arguments)
953 953
     {
954 954
         if ($abstract instanceof Closure) {
955
-            return $this->display(function ($value) use ($abstract, $arguments) {
955
+            return $this->display(function($value) use ($abstract, $arguments) {
956 956
                 return $abstract->call($this, ...array_merge([$value], $arguments));
957 957
             });
958 958
         }
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
             $grid = $this->grid;
962 962
             $column = $this;
963 963
 
964
-            return $this->display(function ($value) use ($abstract, $grid, $column, $arguments) {
964
+            return $this->display(function($value) use ($abstract, $grid, $column, $arguments) {
965 965
                 /** @var AbstractDisplayer $displayer */
966 966
                 $displayer = new $abstract($value, $grid, $column, $this);
967 967
 
Please login to merge, or discard this patch.
src/Grid/Tools/PerPageSelector.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
     {
68 68
         Admin::script($this->script());
69 69
 
70
-        $options = $this->getOptions()->map(function ($option) {
70
+        $options = $this->getOptions()->map(function($option) {
71 71
             $selected = ($option == $this->perPage) ? 'selected' : '';
72 72
             $url = \request()->fullUrlWithQuery([$this->perPageName => $option]);
73 73
 
Please login to merge, or discard this patch.
src/Grid/Tools/Selector.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@
 block discarded – undo
106 106
             return [];
107 107
         }
108 108
 
109
-        $selected = array_filter($selected, function ($value) {
109
+        $selected = array_filter($selected, function($value) {
110 110
             return !is_null($value);
111 111
         });
112 112
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
      * @param string $column
58 58
      * @param string $label
59 59
      * @param array  $options
60
-     * @param null   $query
60
+     * @param null|\Closure   $query
61 61
      * @param string $type
62 62
      *
63 63
      * @return $this
Please login to merge, or discard this patch.
src/Grid/Concerns/HasSelector.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
         call_user_func($closure, $this->selector);
28 28
 
29
-        $this->header(function () {
29
+        $this->header(function() {
30 30
             return $this->renderSelector();
31 31
         });
32 32
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
         $active = Selector::parseSelected();
48 48
 
49
-        $this->selector->getSelectors()->each(function ($selector, $column) use ($active) {
49
+        $this->selector->getSelectors()->each(function($selector, $column) use ($active) {
50 50
             if (!array_key_exists($column, $active)) {
51 51
                 return;
52 52
             }
Please login to merge, or discard this patch.
src/Controllers/MenuController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
         return $content
27 27
             ->title(trans('admin.menu'))
28 28
             ->description(trans('admin.list'))
29
-            ->row(function (Row $row) {
29
+            ->row(function(Row $row) {
30 30
                 $row->column(6, $this->treeView()->render());
31 31
 
32
-                $row->column(6, function (Column $column) {
32
+                $row->column(6, function(Column $column) {
33 33
                     $form = new \Encore\Admin\Widgets\Form();
34 34
                     $form->action(admin_url('auth/menu'));
35 35
 
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
     {
72 72
         $menuModel = config('admin.database.menu_model');
73 73
 
74
-        return $menuModel::tree(function (Tree $tree) {
74
+        return $menuModel::tree(function(Tree $tree) {
75 75
             $tree->disableCreate();
76 76
 
77
-            $tree->branch(function ($branch) {
77
+            $tree->branch(function($branch) {
78 78
                 $payload = "<i class='fa {$branch['icon']}'></i>&nbsp;<strong>{$branch['title']}</strong>";
79 79
 
80 80
                 if (!isset($branch['children'])) {
Please login to merge, or discard this patch.
src/Grid/Displayers/Label.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
             $this->value = $this->value->toArray();
14 14
         }
15 15
 
16
-        return collect((array) $this->value)->map(function ($item) use ($style) {
16
+        return collect((array) $this->value)->map(function($item) use ($style) {
17 17
             if (is_array($style)) {
18 18
                 if (is_string($this->getColumn()->getOriginal()) || is_int($this->getColumn()->getOriginal())) {
19 19
                     $style = Arr::get($style, $this->getColumn()->getOriginal(), 'success');
Please login to merge, or discard this patch.