Skip to content

Commit 2ff7952

Browse files
committed
Apply fixes from StyleCI
[ci skip] [skip ci]
1 parent 98dc5ee commit 2ff7952

File tree

6 files changed

+49
-39
lines changed

6 files changed

+49
-39
lines changed

src/app/Library/CrudPanel/CrudButton.php

+2
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ public function crud()
406406
* so that the developer can see its contents.
407407
*
408408
* @codeCoverageIgnore
409+
*
409410
* @return CrudButton
410411
*/
411412
public function dump()
@@ -421,6 +422,7 @@ public function dump()
421422
* the execution.
422423
*
423424
* @codeCoverageIgnore
425+
*
424426
* @return CrudButton
425427
*/
426428
public function dd()

src/app/Library/CrudPanel/CrudColumn.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ public function key(string $key)
8080
}
8181

8282
$columns = $this->crud()->columns();
83-
83+
8484
$searchKey = $this->attributes['key'];
8585
$column = $this->attributes;
86-
86+
8787
if (isset($columns[$searchKey])) {
8888
unset($columns[$searchKey]);
8989
$column['key'] = $key;
@@ -180,6 +180,7 @@ public function makeLast()
180180
* so that the developer can see its contents.
181181
*
182182
* @codeCoverageIgnore
183+
*
183184
* @return CrudColumn
184185
*/
185186
public function dump()
@@ -193,8 +194,9 @@ public function dump()
193194
* Dump and die. Duumps the current object to the screen,
194195
* so that the developer can see its contents, then stops
195196
* the execution.
196-
*
197+
*
197198
* @codeCoverageIgnore
199+
*
198200
* @return CrudColumn
199201
*/
200202
public function dd()

src/app/Library/CrudPanel/CrudField.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,9 @@ private function save()
385385
/**
386386
* Dump the current object to the screen,
387387
* so that the developer can see its contents.
388-
*
388+
*
389389
* @codeCoverageIgnore
390+
*
390391
* @return CrudField
391392
*/
392393
public function dump()
@@ -400,8 +401,9 @@ public function dump()
400401
* Dump and die. Duumps the current object to the screen,
401402
* so that the developer can see its contents, then stops
402403
* the execution.
403-
*
404+
*
404405
* @codeCoverageIgnore
406+
*
405407
* @return CrudField
406408
*/
407409
public function dd()

src/app/Library/CrudPanel/CrudFilter.php

+2
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@ private function applyDefaultLogic($name, $operator, $input = null)
552552
* so that the developer can see its contents.
553553
*
554554
* @codeCoverageIgnore
555+
*
555556
* @return CrudFilter
556557
*/
557558
public function dump()
@@ -567,6 +568,7 @@ public function dump()
567568
* the execution.
568569
*
569570
* @codeCoverageIgnore
571+
*
570572
* @return CrudFilter
571573
*/
572574
public function dd()

tests/Unit/CrudPanel/CrudPanelColumnsTest.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Backpack\CRUD\Tests\Unit\CrudPanel;
44

5-
use Backpack\CRUD\Tests\Unit\Models\User;
65
use Backpack\CRUD\app\Library\CrudPanel\CrudColumn;
6+
use Backpack\CRUD\Tests\Unit\Models\User;
77

88
/**
99
* @covers Backpack\CRUD\app\Library\CrudPanel\Traits\Columns
@@ -540,7 +540,7 @@ public function testItCanAddAFluentColumn()
540540
$this->crudPanel->setModel(User::class);
541541

542542
$this->crudPanel->column('my_column')->label('my_column');
543-
543+
544544
$this->assertCount(1, $this->crudPanel->columns());
545545

546546
$this->assertEquals([
@@ -555,31 +555,31 @@ public function testItCanAddAFluentColumn()
555555
], $this->crudPanel->columns()['my_column']);
556556
}
557557

558-
public function testItCanMakeAColumnFirstFluently()
558+
public function testItCanMakeAColumnFirstFluently()
559559
{
560560
$this->crudPanel->column('test1');
561561
$this->crudPanel->column('test2')->makeFirst();
562562
$crudColumns = $this->crudPanel->columns();
563563
$firstColumn = reset($crudColumns);
564-
$this->assertEquals($firstColumn['name'],'test2');
564+
$this->assertEquals($firstColumn['name'], 'test2');
565565
}
566566

567-
public function testItCanMakeAColumnLastFluently()
567+
public function testItCanMakeAColumnLastFluently()
568568
{
569569
$this->crudPanel->column('test1');
570570
$this->crudPanel->column('test2');
571571
$this->crudPanel->column('test1')->makeLast();
572572
$crudColumns = $this->crudPanel->columns();
573573
$firstColumn = reset($crudColumns);
574-
$this->assertEquals($firstColumn['name'],'test2');
574+
$this->assertEquals($firstColumn['name'], 'test2');
575575
}
576576

577-
public function testItCanPlaceColumnsFluently()
577+
public function testItCanPlaceColumnsFluently()
578578
{
579579
$this->crudPanel->column('test1');
580580
$this->crudPanel->column('test2');
581581
$this->crudPanel->column('test3')->after('test1');
582-
582+
583583
$crudColumnsNames = array_column($this->crudPanel->columns(), 'name');
584584
$this->assertEquals($crudColumnsNames, ['test1', 'test3', 'test2']);
585585

@@ -588,23 +588,23 @@ public function testItCanPlaceColumnsFluently()
588588
$this->assertEquals($crudColumnsNames, ['test4', 'test1', 'test3', 'test2']);
589589
}
590590

591-
public function testItCanRemoveColumnAttributesFluently()
591+
public function testItCanRemoveColumnAttributesFluently()
592592
{
593593
$this->crudPanel->column('test1')->type('test');
594594
$this->assertEquals($this->crudPanel->columns()['test1']['type'], 'test');
595595
$this->crudPanel->column('test1')->forget('type');
596596
$this->assertNull($this->crudPanel->columns()['test1']['type'] ?? null);
597597
}
598598

599-
public function testItCanRemoveColumnFluently()
599+
public function testItCanRemoveColumnFluently()
600600
{
601601
$this->crudPanel->column('test1')->type('test');
602602
$this->assertCount(1, $this->crudPanel->columns());
603603
$this->crudPanel->column('test1')->remove();
604604
$this->assertCount(0, $this->crudPanel->columns());
605605
}
606606

607-
public function testItCanAddAColumnToCrudFromClass()
607+
public function testItCanAddAColumnToCrudFromClass()
608608
{
609609
CrudColumn::name('test');
610610
$this->assertCount(1, $this->crudPanel->columns());

tests/Unit/CrudPanel/CrudPanelFieldsTest.php

+25-23
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
namespace Backpack\CRUD\Tests\Unit\CrudPanel;
44

55
use Arr;
6-
use Backpack\CRUD\Tests\Unit\Models\User;
6+
use Backpack\CRUD\app\Library\CrudPanel\CrudField;
77
use Backpack\CRUD\Tests\Unit\Models\Star;
8+
use Backpack\CRUD\Tests\Unit\Models\User;
89
use Illuminate\Http\Request;
9-
use Backpack\CRUD\app\Library\CrudPanel\CrudField;
1010

1111
/**
1212
* @covers Backpack\CRUD\app\Library\CrudPanel\Traits\Fields
@@ -743,7 +743,9 @@ public function testItCanAddAFluentField()
743743
->validationMessages(['required' => 'is_required', 'min' => 'min_2'])
744744
->store_in('some')
745745
->size(6)
746-
->on('created', function() { return; })
746+
->on('created', function () {
747+
748+
})
747749
->subfields([['name' => 'sub_1']])
748750
->entity('bang');
749751

@@ -774,47 +776,48 @@ public function testItCanAddAFluentField()
774776
'class' => 'form-group col-md-6',
775777
],
776778
'events' => [
777-
'created' => function() { return; }
779+
'created' => function () {
780+
781+
},
778782
],
779783
'subfields' => [
780784
[
781785
'name' => 'sub_1',
782786
'parentFieldName' => 'my_field',
783787
'type' => 'text',
784788
'entity' => false,
785-
'label' => 'Sub 1'
786-
]
787-
]
788-
789+
'label' => 'Sub 1',
790+
],
791+
],
789792

790793
], $this->crudPanel->fields()['my_field']);
791794
}
792795

793-
public function testItCanMakeAFieldFirstFluently()
796+
public function testItCanMakeAFieldFirstFluently()
794797
{
795798
$this->crudPanel->field('test1');
796799
$this->crudPanel->field('test2')->makeFirst();
797800
$crudFields = $this->crudPanel->fields();
798801
$firstField = reset($crudFields);
799-
$this->assertEquals($firstField['name'],'test2');
802+
$this->assertEquals($firstField['name'], 'test2');
800803
}
801804

802-
public function testItCanMakeAFieldLastFluently()
805+
public function testItCanMakeAFieldLastFluently()
803806
{
804807
$this->crudPanel->field('test1');
805808
$this->crudPanel->field('test2');
806809
$this->crudPanel->field('test1')->makeLast();
807810
$crudFields = $this->crudPanel->fields();
808811
$firstField = reset($crudFields);
809-
$this->assertEquals($firstField['name'],'test2');
812+
$this->assertEquals($firstField['name'], 'test2');
810813
}
811814

812-
public function testItCanPlaceFieldsFluently()
815+
public function testItCanPlaceFieldsFluently()
813816
{
814817
$this->crudPanel->field('test1');
815818
$this->crudPanel->field('test2');
816819
$this->crudPanel->field('test3')->after('test1');
817-
820+
818821
$crudFieldsNames = array_column($this->crudPanel->fields(), 'name');
819822
$this->assertEquals($crudFieldsNames, ['test1', 'test3', 'test2']);
820823

@@ -823,61 +826,60 @@ public function testItCanPlaceFieldsFluently()
823826
$this->assertEquals($crudFieldsNames, ['test4', 'test1', 'test3', 'test2']);
824827
}
825828

826-
public function testItCanRemoveFieldAttributesFluently()
829+
public function testItCanRemoveFieldAttributesFluently()
827830
{
828831
$this->crudPanel->field('test1')->type('test');
829832
$this->assertEquals($this->crudPanel->fields()['test1']['type'], 'test');
830833
$this->crudPanel->field('test1')->forget('type');
831834
$this->assertNull($this->crudPanel->fields()['test1']['type'] ?? null);
832835
}
833836

834-
public function testItCanRemoveFieldFluently()
837+
public function testItCanRemoveFieldFluently()
835838
{
836839
$this->crudPanel->field('test1')->type('test');
837840
$this->assertCount(1, $this->crudPanel->fields());
838841
$this->crudPanel->field('test1')->remove();
839842
$this->assertCount(0, $this->crudPanel->fields());
840843
}
841844

842-
public function testItCanAddMorphFieldsFluently()
845+
public function testItCanAddMorphFieldsFluently()
843846
{
844847
$this->crudPanel->setModel(Star::class);
845848
$this->crudPanel->field('starable')
846849
->addMorphOption('Backpack\CRUD\Tests\Unit\Models\User', 'User')
847850
->morphTypeField(['attributes' => ['custom-attribute' => true]])
848851
->morphIdField(['attributes' => ['custom-attribute' => true]]);
849-
852+
850853
[$morphTypeField, $morphIdField] = $this->crudPanel->fields()['starable']['subfields'];
851854

852855
$this->assertTrue($morphTypeField['attributes']['custom-attribute']);
853856
$this->assertTrue($morphIdField['attributes']['custom-attribute']);
854857
}
855858

856-
public function testAbortsConfiguringNonMorphTypeField()
859+
public function testAbortsConfiguringNonMorphTypeField()
857860
{
858861
$this->crudPanel->setModel(Star::class);
859862
$this->expectException(\Exception::class);
860863
$this->crudPanel->field('some_field')
861864
->morphTypeField(['attributes' => ['custom-attribute' => true]]);
862865
}
863866

864-
public function testAbortsConfiguringNonMorphIdField()
867+
public function testAbortsConfiguringNonMorphIdField()
865868
{
866869
$this->crudPanel->setModel(Star::class);
867870
$this->expectException(\Exception::class);
868871
$this->crudPanel->field('some_field')
869872
->morphIdField(['attributes' => ['custom-attribute' => true]]);
870873
}
871874

872-
public function testItCanGetTheFieldAttributes()
875+
public function testItCanGetTheFieldAttributes()
873876
{
874-
875877
$this->crudPanel->field('some_field');
876878

877879
$this->assertEquals($this->crudPanel->fields()['some_field'], $this->crudPanel->field('some_field')->getAttributes());
878880
}
879881

880-
public function testItAbortsWithEmptyNamesFluently()
882+
public function testItAbortsWithEmptyNamesFluently()
881883
{
882884
try {
883885
CrudField::name('');

0 commit comments

Comments
 (0)