Completed
Pull Request — master (#4435)
by Muhlis
07:58
created
src/Grid/Tools/Paginator.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
     /**
42 42
      * Get Pagination links.
43 43
      *
44
-     * @return string
44
+     * @return \Illuminate\Contracts\View\View
45 45
      */
46 46
     protected function paginationLinks()
47 47
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             'total' => $this->paginator->total(),
72 72
         ];
73 73
 
74
-        $parameters = collect($parameters)->flatMap(function ($parameter, $key) {
74
+        $parameters = collect($parameters)->flatMap(function($parameter, $key) {
75 75
             return [$key => "<b>$parameter</b>"];
76 76
         });
77 77
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     public function render()
87 87
     {
88
-        if (! $this->grid->showPagination()) {
88
+        if (!$this->grid->showPagination()) {
89 89
             return '';
90 90
         }
91 91
 
Please login to merge, or discard this patch.
src/Show/Panel.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     /**
129 129
      * Build panel tools.
130 130
      *
131
-     * @param $callable
131
+     * @param \Closure $callable
132 132
      */
133 133
     public function tools($callable)
134 134
     {
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     /**
139 139
      * Fill fields to panel.
140 140
      *
141
-     * @param []Field $fields
141
+     * @param Collection $fields
142 142
      *
143 143
      * @return $this
144 144
      */
Please login to merge, or discard this patch.
src/Controllers/UserController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
         $grid->column('created_at', trans('admin.created_at'));
35 35
         $grid->column('updated_at', trans('admin.updated_at'));
36 36
 
37
-        $grid->actions(function (Grid\Displayers\Actions $actions) {
37
+        $grid->actions(function(Grid\Displayers\Actions $actions) {
38 38
             if ($actions->getKey() == 1) {
39 39
                 $actions->disableDelete();
40 40
             }
41 41
         });
42 42
 
43
-        $grid->tools(function (Grid\Tools $tools) {
44
-            $tools->batch(function (Grid\Tools\BatchActions $actions) {
43
+        $grid->tools(function(Grid\Tools $tools) {
44
+            $tools->batch(function(Grid\Tools\BatchActions $actions) {
45 45
                 $actions->disableDelete();
46 46
             });
47 47
         });
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
         $show->field('id', 'ID');
66 66
         $show->field('username', trans('admin.username'));
67 67
         $show->field('name', trans('admin.name'));
68
-        $show->field('roles', trans('admin.roles'))->as(function ($roles) {
68
+        $show->field('roles', trans('admin.roles'))->as(function($roles) {
69 69
             return $roles->pluck('name');
70 70
         })->label();
71
-        $show->field('permissions', trans('admin.permissions'))->as(function ($permission) {
71
+        $show->field('permissions', trans('admin.permissions'))->as(function($permission) {
72 72
             return $permission->pluck('name');
73 73
         })->label();
74 74
         $show->field('created_at', trans('admin.created_at'));
75 75
         $show->field('updated_at', trans('admin.updated_at'));
76
-        $show->panel()->tools(function ($tools) use ($id) {
76
+        $show->panel()->tools(function($tools) use ($id) {
77 77
             if ($id == 1) {
78 78
                 $tools->disableDelete();
79 79
             }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         $form->image('avatar', trans('admin.avatar'));
108 108
         $form->password('password', trans('admin.password'))->rules('required|confirmed');
109 109
         $form->password('password_confirmation', trans('admin.password_confirmation'))->rules('required')
110
-            ->default(function ($form) {
110
+            ->default(function($form) {
111 111
                 return $form->model()->password;
112 112
             });
113 113
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         $form->display('created_at', trans('admin.created_at'));
120 120
         $form->display('updated_at', trans('admin.updated_at'));
121 121
 
122
-        $form->saving(function (Form $form) {
122
+        $form->saving(function(Form $form) {
123 123
             if ($form->password && $form->model()->password != $form->password) {
124 124
                 $form->password = bcrypt($form->password);
125 125
             }
Please login to merge, or discard this patch.
src/Grid/Exporters/CsvExporter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
             'Content-Disposition' => "attachment; filename=\"$filename\"",
23 23
         ];
24 24
 
25
-        response()->stream(function () {
25
+        response()->stream(function() {
26 26
             $handle = fopen('php://output', 'w');
27 27
 
28 28
             $titles = [];
29 29
 
30
-            $this->chunk(function ($records) use ($handle, &$titles) {
30
+            $this->chunk(function($records) use ($handle, &$titles) {
31 31
                 if (empty($titles)) {
32 32
                     $titles = $this->getHeaderRowFromRecords($records);
33 33
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     public function getHeaderRowFromRecords(Collection $records): array
56 56
     {
57 57
         $titles = collect(Arr::dot($records->first()->getAttributes()))->keys()->map(
58
-            function ($key) {
58
+            function($key) {
59 59
                 $key = str_replace('.', ' ', $key);
60 60
 
61 61
                 return Str::ucfirst($key);
Please login to merge, or discard this patch.
src/Form/Field.php 2 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
      *
282 282
      * @param string $column
283 283
      *
284
-     * @return mixed|string
284
+     * @return string
285 285
      */
286 286
     protected function formatColumn($column = '')
287 287
     {
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
     }
575 575
 
576 576
     /**
577
-     * @param string|array|Closure $input
577
+     * @param callable|null $input
578 578
      * @param string|array         $original
579 579
      *
580 580
      * @return array|Closure
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
     /**
786 786
      * Set or get value of the field.
787 787
      *
788
-     * @param $value
788
+     * @param string $value
789 789
      *
790 790
      * @return mixed
791 791
      */
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
     /**
957 957
      * Add html attributes to elements.
958 958
      *
959
-     * @param array|string $attribute
959
+     * @param string $attribute
960 960
      * @param mixed        $value
961 961
      *
962 962
      * @return $this
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
     }
1335 1335
 
1336 1336
     /**
1337
-     * @param array $labelClass
1337
+     * @param string[] $labelClass
1338 1338
      *
1339 1339
      * @return self
1340 1340
      */
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
      *
1390 1390
      * @param string $view
1391 1391
      *
1392
-     * @return string
1392
+     * @return Field
1393 1393
      */
1394 1394
     public function setView($view): self
1395 1395
     {
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -520,18 +520,18 @@  discard block
 block discarded – undo
520 520
      */
521 521
     protected function addRequiredAttribute($rules)
522 522
     {
523
-        if (! is_array($rules)) {
523
+        if (!is_array($rules)) {
524 524
             return;
525 525
         }
526 526
 
527
-        if (! in_array('required', $rules, true)) {
527
+        if (!in_array('required', $rules, true)) {
528 528
             return;
529 529
         }
530 530
 
531 531
         $this->setLabelClass(['asterisk']);
532 532
 
533 533
         // Only text field has `required` attribute.
534
-        if (! $this instanceof Form\Field\Text) {
534
+        if (!$this instanceof Form\Field\Text) {
535 535
             return;
536 536
         }
537 537
 
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
         if ($input instanceof Closure) {
587 587
             $rules = $input;
588 588
         } else {
589
-            if (! empty($original)) {
589
+            if (!empty($original)) {
590 590
                 $original = $this->formatRules($original);
591 591
             }
592 592
 
@@ -704,11 +704,11 @@  discard block
 block discarded – undo
704 704
             $rules = array_filter(explode('|', $rules));
705 705
         }
706 706
 
707
-        if (! $this->form) {
707
+        if (!$this->form) {
708 708
             return $rules;
709 709
         }
710 710
 
711
-        if (! $id = $this->form->model()->getKey()) {
711
+        if (!$id = $this->form->model()->getKey()) {
712 712
             return $rules;
713 713
         }
714 714
 
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
             return;
739 739
         }
740 740
 
741
-        if (! is_string($this->rules)) {
741
+        if (!is_string($this->rules)) {
742 742
             return;
743 743
         }
744 744
 
@@ -908,12 +908,12 @@  discard block
 block discarded – undo
908 908
 
909 909
         $rules = $attributes = [];
910 910
 
911
-        if (! $fieldRules = $this->getRules()) {
911
+        if (!$fieldRules = $this->getRules()) {
912 912
             return false;
913 913
         }
914 914
 
915 915
         if (is_string($this->column)) {
916
-            if (! Arr::has($input, $this->column)) {
916
+            if (!Arr::has($input, $this->column)) {
917 917
                 return false;
918 918
             }
919 919
 
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
 
926 926
         if (is_array($this->column)) {
927 927
             foreach ($this->column as $key => $column) {
928
-                if (! array_key_exists($column, $input)) {
928
+                if (!array_key_exists($column, $input)) {
929 929
                     continue;
930 930
                 }
931 931
                 $input[$column.$key] = Arr::get($input, $column);
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
      */
1171 1171
     public function getElementClass(): array
1172 1172
     {
1173
-        if (! $this->elementClass) {
1173
+        if (!$this->elementClass) {
1174 1174
             $name = $this->elementName ?: $this->formatName($this->column);
1175 1175
 
1176 1176
             $this->elementClass = (array) str_replace(['[', ']'], '_', $name);
@@ -1373,7 +1373,7 @@  discard block
 block discarded – undo
1373 1373
      */
1374 1374
     public function getView(): string
1375 1375
     {
1376
-        if (! empty($this->view)) {
1376
+        if (!empty($this->view)) {
1377 1377
             return $this->view;
1378 1378
         }
1379 1379
 
@@ -1441,7 +1441,7 @@  discard block
 block discarded – undo
1441 1441
      */
1442 1442
     protected function shouldRender(): bool
1443 1443
     {
1444
-        if (! $this->display) {
1444
+        if (!$this->display) {
1445 1445
             return false;
1446 1446
         }
1447 1447
 
@@ -1467,7 +1467,7 @@  discard block
 block discarded – undo
1467 1467
      */
1468 1468
     public function render()
1469 1469
     {
1470
-        if (! $this->shouldRender()) {
1470
+        if (!$this->shouldRender()) {
1471 1471
             return '';
1472 1472
         }
1473 1473
 
Please login to merge, or discard this patch.
src/Auth/Database/HasPermissions.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     /**
10 10
      * Get all permissions of user.
11 11
      *
12
-     * @return mixed
12
+     * @return Collection
13 13
      */
14 14
     public function allPermissions(): Collection
15 15
     {
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * Check if user has permission.
21 21
      *
22
-     * @param $ability
22
+     * @param string $ability
23 23
      * @param array $arguments
24 24
      *
25 25
      * @return bool
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     /**
57 57
      * Check if user is administrator.
58 58
      *
59
-     * @return mixed
59
+     * @return boolean
60 60
      */
61 61
     public function isAdministrator(): bool
62 62
     {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      *
69 69
      * @param string $role
70 70
      *
71
-     * @return mixed
71
+     * @return boolean
72 72
      */
73 73
     public function isRole(string $role): bool
74 74
     {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      *
81 81
      * @param array $roles
82 82
      *
83
-     * @return mixed
83
+     * @return boolean
84 84
      */
85 85
     public function inRoles(array $roles = []): bool
86 86
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function cannot(string $permission): bool
52 52
     {
53
-        return ! $this->can($permission);
53
+        return !$this->can($permission);
54 54
     }
55 55
 
56 56
     /**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      */
113 113
     protected static function bootHasPermissions()
114 114
     {
115
-        static::deleting(function ($model) {
115
+        static::deleting(function($model) {
116 116
             $model->roles()->detach();
117 117
 
118 118
             $model->permissions()->detach();
Please login to merge, or discard this patch.
src/Grid/Filter/Presenter/Select.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -303,7 +303,7 @@
 block discarded – undo
303 303
      *
304 304
      * @param string $target
305 305
      *
306
-     * @return mixed
306
+     * @return string
307 307
      */
308 308
     protected function getClass($target): string
309 309
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -112,13 +112,13 @@
 block discarded – undo
112 112
      */
113 113
     public function model($model, $idField = 'id', $textField = 'name')
114 114
     {
115
-        if (! class_exists($model)
116
-            || ! in_array(Model::class, class_parents($model))
115
+        if (!class_exists($model)
116
+            || !in_array(Model::class, class_parents($model))
117 117
         ) {
118 118
             throw new \InvalidArgumentException("[$model] must be a valid model class");
119 119
         }
120 120
 
121
-        $this->options = function ($value) use ($model, $idField, $textField) {
121
+        $this->options = function($value) use ($model, $idField, $textField) {
122 122
             if (empty($value)) {
123 123
                 return [];
124 124
             }
Please login to merge, or discard this patch.
src/Widgets/Form.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     /**
120 120
      * Get form title.
121 121
      *
122
-     * @return mixed
122
+     * @return string
123 123
      */
124 124
     public function title()
125 125
     {
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     /**
184 184
      * Add form attributes.
185 185
      *
186
-     * @param string|array $attr
186
+     * @param string $attr
187 187
      * @param string       $value
188 188
      *
189 189
      * @return $this
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
             $data = $data->toArray();
148 148
         }
149 149
 
150
-        if (! empty($data)) {
150
+        if (!empty($data)) {
151 151
             $this->data = $data;
152 152
         }
153 153
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
      */
301 301
     public function setWidth($fieldWidth = 8, $labelWidth = 2)
302 302
     {
303
-        collect($this->fields)->each(function ($field) use ($fieldWidth, $labelWidth) {
303
+        collect($this->fields)->each(function($field) use ($fieldWidth, $labelWidth) {
304 304
             /* @var Field $field  */
305 305
             $field->setWidth($fieldWidth, $labelWidth);
306 306
         });
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
 
402 402
         /** @var Field $field */
403 403
         foreach ($this->fields() as $field) {
404
-            if (! $validator = $field->getValidator($request->all())) {
404
+            if (!$validator = $field->getValidator($request->all())) {
405 405
                 continue;
406 406
             }
407 407
 
408
-            if (($validator instanceof Validator) && ! $validator->passes()) {
408
+            if (($validator instanceof Validator) && !$validator->passes()) {
409 409
                 $failedValidators[] = $validator;
410 410
             }
411 411
         }
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 
494 494
         $form = view('admin::widgets.form', $this->getVariables())->render();
495 495
 
496
-        if (! ($title = $this->title()) || ! $this->inbox) {
496
+        if (!($title = $this->title()) || !$this->inbox) {
497 497
             return $form;
498 498
         }
499 499
 
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
      */
511 511
     public function __call($method, $arguments)
512 512
     {
513
-        if (! $this->hasField($method)) {
513
+        if (!$this->hasField($method)) {
514 514
             return $this;
515 515
         }
516 516
 
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 
519 519
         $field = new $class(Arr::get($arguments, 0), array_slice($arguments, 1));
520 520
 
521
-        return tap($field, function ($field) {
521
+        return tap($field, function($field) {
522 522
             $this->pushField($field);
523 523
         });
524 524
     }
Please login to merge, or discard this patch.
src/Widgets/ContainsForms.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      * @param array $forms
14 14
      * @param null  $active
15 15
      *
16
-     * @return mixed
16
+     * @return ContainsForms
17 17
      */
18 18
     public static function forms($forms, $active = null)
19 19
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@
 block discarded – undo
32 32
     {
33 33
         $active = $active ?: request($this->activeName);
34 34
 
35
-        if (! isset($forms[$active])) {
35
+        if (!isset($forms[$active])) {
36 36
             $active = key($forms);
37 37
         }
38 38
 
39 39
         foreach ($forms as $name => $class) {
40
-            if (! is_subclass_of($class, Form::class)) {
40
+            if (!is_subclass_of($class, Form::class)) {
41 41
                 admin_error("Class [{$class}] must be a sub-class of [Encore\Admin\Widgets\Form].");
42 42
                 continue;
43 43
             }
Please login to merge, or discard this patch.