Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Test Setup Failed
Pull Request — master (#4152)
by Cristian
12:03
created
src/app/Library/CrudPanel/CrudButton.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
     {
275 275
         $type = $this->name;
276 276
 
277
-        $paths = array_map(function ($item) use ($type) {
277
+        $paths = array_map(function($item) use ($type) {
278 278
             return $item.'.'.$type;
279 279
         }, config('backpack.crud.view_namespaces.buttons'));
280 280
 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
     {
441 441
         $itemExists = $this->collection()->contains('name', $this->name);
442 442
 
443
-        if (! $itemExists) {
443
+        if (!$itemExists) {
444 444
             if ($this->position == 'beginning') {
445 445
                 $this->collection()->prepend($this);
446 446
             } else {
Please login to merge, or discard this patch.
src/app/Library/Widget.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         }
135 135
 
136 136
         $type = $this->type;
137
-        $paths = array_map(function ($item) use ($type) {
137
+        $paths = array_map(function($item) use ($type) {
138 138
             return $item.'.'.$type;
139 139
         }, config('backpack.base.component_view_namespaces.widgets'));
140 140
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     {
228 228
         $itemExists = $this->collection()->contains('name', $this->attributes['name']);
229 229
 
230
-        if (! $itemExists) {
230
+        if (!$itemExists) {
231 231
             $this->collection()->put($this->attributes['name'], $this);
232 232
         } else {
233 233
             $this->collection()[$this->name] = $this;
Please login to merge, or discard this patch.
database/migrations/2020_03_31_114745_create_pivotable_relations_tables.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('comments', function (Blueprint $table) {
16
+        Schema::create('comments', function(Blueprint $table) {
17 17
             $table->bigIncrements('id');
18 18
             $table->string('text')->nullable();
19 19
             $table->morphs('commentable');
20 20
             $table->timestamps();
21 21
         });
22 22
 
23
-        Schema::create('recommendables', function (Blueprint $table) {
23
+        Schema::create('recommendables', function(Blueprint $table) {
24 24
             $table->bigIncrements('id');
25 25
             $table->string('text')->nullable();
26 26
             $table->morphs('recommendable');
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
             $table->timestamps();
29 29
         });
30 30
 
31
-        Schema::create('billables', function (Blueprint $table) {
31
+        Schema::create('billables', function(Blueprint $table) {
32 32
             $table->bigIncrements('id');
33 33
             $table->string('text')->nullable();
34 34
             $table->morphs('billable');
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             $table->timestamps();
37 37
         });
38 38
 
39
-        Schema::create('articles_user', function (Blueprint $table) {
39
+        Schema::create('articles_user', function(Blueprint $table) {
40 40
             $table->increments('id');
41 41
             $table->integer('article_id')->unsigned();
42 42
             $table->integer('user_id')->unsigned();
@@ -44,54 +44,54 @@  discard block
 block discarded – undo
44 44
             $table->nullableTimestamps();
45 45
         });
46 46
 
47
-        Schema::create('recommends', function (Blueprint $table) {
47
+        Schema::create('recommends', function(Blueprint $table) {
48 48
             $table->bigIncrements('id');
49 49
             $table->string('title')->nullable();
50 50
             $table->timestamps();
51 51
         });
52 52
 
53
-        Schema::create('bills', function (Blueprint $table) {
53
+        Schema::create('bills', function(Blueprint $table) {
54 54
             $table->bigIncrements('id');
55 55
             $table->string('title')->nullable();
56 56
             $table->timestamps();
57 57
         });
58 58
 
59
-        Schema::create('stars', function (Blueprint $table) {
59
+        Schema::create('stars', function(Blueprint $table) {
60 60
             $table->bigIncrements('id');
61 61
             $table->string('starable_type');
62 62
             $table->bigInteger('starable_id');
63 63
             $table->string('title')->nullable();
64 64
         });
65 65
 
66
-        Schema::create('universes', function (Blueprint $table) {
66
+        Schema::create('universes', function(Blueprint $table) {
67 67
             $table->bigIncrements('id');
68 68
             $table->bigInteger('user_id');
69 69
             $table->string('title')->nullable();
70 70
         });
71 71
 
72
-        Schema::create('planets', function (Blueprint $table) {
72
+        Schema::create('planets', function(Blueprint $table) {
73 73
             $table->bigIncrements('id');
74 74
             $table->bigInteger('user_id')->nullable();
75 75
             $table->string('title')->nullable();
76 76
         });
77 77
 
78
-        Schema::create('comets', function (Blueprint $table) {
78
+        Schema::create('comets', function(Blueprint $table) {
79 79
             $table->bigIncrements('id');
80 80
             $table->bigInteger('user_id')->default(0);
81 81
         });
82 82
 
83
-        Schema::create('bangs', function (Blueprint $table) {
83
+        Schema::create('bangs', function(Blueprint $table) {
84 84
             $table->bigIncrements('id');
85 85
             $table->string('name');
86 86
         });
87 87
 
88
-        Schema::create('account_details_bang', function (Blueprint $table) {
88
+        Schema::create('account_details_bang', function(Blueprint $table) {
89 89
             $table->bigIncrements('id');
90 90
             $table->bigInteger('account_details_id');
91 91
             $table->bigInteger('bang_id');
92 92
         });
93 93
 
94
-        Schema::create('account_details_bangs_pivot', function (Blueprint $table) {
94
+        Schema::create('account_details_bangs_pivot', function(Blueprint $table) {
95 95
             $table->bigIncrements('id');
96 96
             $table->bigInteger('account_details_id');
97 97
             $table->bigInteger('bang_id');
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/Views.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -297,7 +297,7 @@
 block discarded – undo
297 297
 
298 298
         // otherwise, loop through all the possible view namespaces
299 299
         // until you find a view that exists
300
-        $paths = array_map(function ($item) use ($viewPath) {
300
+        $paths = array_map(function($item) use ($viewPath) {
301 301
             return $item.'.'.$viewPath;
302 302
         }, config('backpack.crud.view_namespaces.fields'));
303 303
 
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/Fields.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function afterField($targetFieldName)
119 119
     {
120
-        $this->transformFields(function ($fields) use ($targetFieldName) {
120
+        $this->transformFields(function($fields) use ($targetFieldName) {
121 121
             return $this->moveField($fields, $targetFieldName, false);
122 122
         });
123 123
     }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function beforeField($targetFieldName)
131 131
     {
132
-        $this->transformFields(function ($fields) use ($targetFieldName) {
132
+        $this->transformFields(function($fields) use ($targetFieldName) {
133 133
             return $this->moveField($fields, $targetFieldName, true);
134 134
         });
135 135
     }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      */
142 142
     public function makeFirstField()
143 143
     {
144
-        if (! $this->fields()) {
144
+        if (!$this->fields()) {
145 145
             return false;
146 146
         }
147 147
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function removeField($name)
158 158
     {
159
-        $this->transformFields(function ($fields) use ($name) {
159
+        $this->transformFields(function($fields) use ($name) {
160 160
             Arr::forget($fields, $name);
161 161
 
162 162
             return $fields;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function removeFields($array_of_names)
172 172
     {
173
-        if (! empty($array_of_names)) {
173
+        if (!empty($array_of_names)) {
174 174
             foreach ($array_of_names as $name) {
175 175
                 $this->removeField($name);
176 176
             }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     public function removeAllFields()
184 184
     {
185 185
         $current_fields = $this->getCleanStateFields();
186
-        if (! empty($current_fields)) {
186
+        if (!empty($current_fields)) {
187 187
             foreach ($current_fields as $field) {
188 188
                 $this->removeField($field['name']);
189 189
             }
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
                 $jsonCastables = ['array', 'object', 'json'];
281 281
                 $fieldCasting = $casted_attributes[$field['name']];
282 282
 
283
-                if (in_array($fieldCasting, $jsonCastables) && isset($input[$field['name']]) && ! empty($input[$field['name']]) && ! is_array($input[$field['name']])) {
283
+                if (in_array($fieldCasting, $jsonCastables) && isset($input[$field['name']]) && !empty($input[$field['name']]) && !is_array($input[$field['name']])) {
284 284
                     try {
285 285
                         $input[$field['name']] = json_decode($input[$field['name']]);
286 286
                     } catch (\Exception $e) {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
      */
310 310
     public function orderFields($order)
311 311
     {
312
-        $this->transformFields(function ($fields) use ($order) {
312
+        $this->transformFields(function($fields) use ($order) {
313 313
             return $this->applyOrderToFields($fields, $order);
314 314
         });
315 315
     }
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
     public function hasUploadFields()
336 336
     {
337 337
         $fields = $this->getCleanStateFields();
338
-        $upload_fields = Arr::where($fields, function ($value, $key) {
338
+        $upload_fields = Arr::where($fields, function($value, $key) {
339 339
             return isset($value['upload']) && $value['upload'] == true;
340 340
         });
341 341
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
         $alreadyLoaded = $this->getLoadedFieldTypes();
399 399
         $type = $this->getFieldTypeWithNamespace($field);
400 400
 
401
-        if (! in_array($type, $this->getLoadedFieldTypes(), true)) {
401
+        if (!in_array($type, $this->getLoadedFieldTypes(), true)) {
402 402
             $alreadyLoaded[] = $type;
403 403
             $this->setLoadedFieldTypes($alreadyLoaded);
404 404
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
      */
440 440
     public function fieldTypeNotLoaded($field)
441 441
     {
442
-        return ! in_array($this->getFieldTypeWithNamespace($field), $this->getLoadedFieldTypes());
442
+        return !in_array($this->getFieldTypeWithNamespace($field), $this->getLoadedFieldTypes());
443 443
     }
444 444
 
445 445
     /**
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
      */
480 480
     public function hasFieldWhere($attribute, $value)
481 481
     {
482
-        $match = Arr::first($this->getCleanStateFields(), function ($field, $fieldKey) use ($attribute, $value) {
482
+        $match = Arr::first($this->getCleanStateFields(), function($field, $fieldKey) use ($attribute, $value) {
483 483
             return isset($field[$attribute]) && $field[$attribute] == $value;
484 484
         });
485 485
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
      */
496 496
     public function firstFieldWhere($attribute, $value)
497 497
     {
498
-        return Arr::first($this->getCleanStateFields(), function ($field, $fieldKey) use ($attribute, $value) {
498
+        return Arr::first($this->getCleanStateFields(), function($field, $fieldKey) use ($attribute, $value) {
499 499
             return isset($field[$attribute]) && $field[$attribute] == $value;
500 500
         });
501 501
     }
Please login to merge, or discard this patch.
tests/Unit/CrudPanel/CrudPanelCreateTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 
594 594
     public function testCreateBelongsToFake()
595 595
     {
596
-        $belongsToField = [   // select_grouped
596
+        $belongsToField = [// select_grouped
597 597
             'label'                      => 'Select_grouped',
598 598
             'type'                       => 'select_grouped', //https://github.com/Laravel-Backpack/CRUD/issues/502
599 599
             'name'                       => 'bang_relation_field',
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
                 'nickname' => 'i_have_has_one',
728 728
                 'profile_picture' => 'ohh my picture 1.jpg',
729 729
                 'article' => 1,
730
-                'addresses' => [ // HasOne is tested in other test function
730
+                'addresses' => [// HasOne is tested in other test function
731 731
                     [
732 732
                         'city' => 2,
733 733
                         'street' => 'test',
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/Create.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                     // - a single dimensional array: [1,2,3]
112 112
                     // - an array of arrays: [[1][2][3]]
113 113
                     // if is as single dimensional array we can only attach.
114
-                    if ($relationValues === null || ! is_multidimensional_array($relationValues)) {
114
+                    if ($relationValues === null || !is_multidimensional_array($relationValues)) {
115 115
                         $this->attachManyRelation($item, $relation, $relationDetails, $relationValues);
116 116
                     } else {
117 117
                         $this->createManyEntries($item, $relation, $relationMethod, $relationDetails);
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
             return $removedEntries->delete();
265 265
         }
266 266
 
267
-        if (! $relationColumnIsNullable && $modelInstance->dbColumnHasDefault($relationForeignKey)) {
267
+        if (!$relationColumnIsNullable && $modelInstance->dbColumnHasDefault($relationForeignKey)) {
268 268
             return $removedEntries->update([$relationForeignKey => $modelInstance->getDbColumnDefault($relationForeignKey)]);
269 269
         }
270 270
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
         }
309 309
 
310 310
         // use the collection of sent ids to match agains database ids, delete the ones not found in the submitted ids.
311
-        if (! empty($relatedItemsSent)) {
311
+        if (!empty($relatedItemsSent)) {
312 312
             // we perform the cleanup of removed database items
313 313
             $entry->{$relationMethod}()->whereNotIn($relation_local_key, $relatedItemsSent)->delete();
314 314
         }
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/Input.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         }
98 98
 
99 99
         //remove fields that are not in the submitted form input
100
-        $relationFields = array_filter($relationFields, function ($field) use ($input) {
100
+        $relationFields = array_filter($relationFields, function($field) use ($input) {
101 101
             return Arr::has($input, $field['name']) || isset($input[$field['name']]) || Arr::has($input, Str::afterLast($field['name'], '.'));
102 102
         });
103 103
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
             // when using dot notation if relationMethod is not set we are sure we want to exclude those relations.
178 178
             if ($this->getOnlyRelationEntity($field) !== $field['entity']) {
179
-                if (! $relationMethod) {
179
+                if (!$relationMethod) {
180 180
                     $excludedFields[] = $nameToExclude;
181 181
                 }
182 182
                 continue;
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
             }
189 189
         }
190 190
 
191
-        return Arr::where($input, function ($item, $key) use ($excludedFields) {
192
-            return ! in_array($key, $excludedFields);
191
+        return Arr::where($input, function($item, $key) use ($excludedFields) {
192
+            return !in_array($key, $excludedFields);
193 193
         });
194 194
     }
195 195
 }
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Traits/Relationships.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         $model = $this->getRelationModel($entity, -1);
66 66
         $lastSegmentAfterDot = Str::of($field['entity'])->afterLast('.');
67 67
 
68
-        if (! method_exists($model, $lastSegmentAfterDot)) {
68
+        if (!method_exists($model, $lastSegmentAfterDot)) {
69 69
             return (string) Str::of($field['entity'])->beforeLast('.');
70 70
         }
71 71
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
         return collect($this->getCleanStateFields())
88 88
             ->whereIn('relation_type', $relation_types)
89
-            ->filter(function ($item) use ($nested) {
89
+            ->filter(function($item) use ($nested) {
90 90
                 if ($nested) {
91 91
                     return true;
92 92
                 }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     private function getRelationFieldsWithoutRelationType($relations, $fields = [])
132 132
     {
133
-        if (! is_array($relations)) {
133
+        if (!is_array($relations)) {
134 134
             $relations = [$relations];
135 135
         }
136 136
 
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
         }
140 140
 
141 141
         foreach ($relations as $relation) {
142
-            $fields = array_filter($fields, function ($field) use ($relation) {
143
-                if (! isset($field['relation_type'])) {
142
+            $fields = array_filter($fields, function($field) use ($relation) {
143
+                if (!isset($field['relation_type'])) {
144 144
                     return false;
145 145
                 }
146 146
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                     $fields = array_merge($field['subfields'], $fields);
175 175
                 }
176 176
             }
177
-            $fields = array_filter($fields, function ($field) {
177
+            $fields = array_filter($fields, function($field) {
178 178
                 return isset($field['relation_type']) && $field['relation_type'] === 'BelongsTo';
179 179
             });
180 180
         }
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
     {
244 244
         $all_relation_fields = $this->getRelationFields();
245 245
 
246
-        return Arr::where($all_relation_fields, function ($value, $key) {
247
-            return isset($value['pivot']) && ! $value['pivot'];
246
+        return Arr::where($all_relation_fields, function($value, $key) {
247
+            return isset($value['pivot']) && !$value['pivot'];
248 248
         });
249 249
     }
250 250
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
     {
258 258
         $all_relation_fields = $this->getRelationFields();
259 259
 
260
-        return Arr::where($all_relation_fields, function ($value, $key) {
260
+        return Arr::where($all_relation_fields, function($value, $key) {
261 261
             return isset($value['pivot']) && $value['pivot'];
262 262
         });
263 263
     }
Please login to merge, or discard this patch.