Skip to content

Commit c21ed0a

Browse files
authored
Merge pull request #84 from Lanatel/analysis-2ZQAag
Apply fixes from StyleCI
2 parents 221aa35 + 78e58e9 commit c21ed0a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+547
-377
lines changed

src/Relations/AbstractRelation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ abstract protected function createAssociation(ClassMetadataBuilder $builder, $re
8686
public function cascade(array $cascade)
8787
{
8888
foreach ($cascade as $name) {
89-
$method = 'cascade'.(InflectorFactory::create()->build())->classify(strtolower($name));
89+
$method = 'cascade'.InflectorFactory::create()->build()->classify(strtolower($name));
9090

9191
if (!method_exists($this->association, $method)) {
9292
throw new InvalidArgumentException('Cascade ['.$name.'] does not exist');
@@ -105,7 +105,7 @@ public function cascade(array $cascade)
105105
*/
106106
public function fetch($strategy)
107107
{
108-
$method = 'fetch'.(InflectorFactory::create()->build())->classify(strtolower($strategy));
108+
$method = 'fetch'.InflectorFactory::create()->build()->classify(strtolower($strategy));
109109

110110
if (!method_exists($this->association, $method)) {
111111
throw new InvalidArgumentException('Fetch ['.$strategy.'] does not exist');

tests/Builders/BuilderTest.php

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141

4242
class BuilderTest extends TestCase
4343
{
44-
use IsMacroable, MockeryPHPUnitIntegration;
44+
use IsMacroable;
45+
use MockeryPHPUnitIntegration;
4546

4647
/**
4748
* @var ClassMetadataBuilder
@@ -549,8 +550,9 @@ public function test_has_one_implies_an_inverse_one_to_one()
549550

550551
$result = $this->builder->getClassMetadata()->associationMappings['one'];
551552

552-
$this->assertFalse($result['isOwningSide'],
553-
"HasOne relation is an inversed one-to-one, but resulted in the owning side."
553+
$this->assertFalse(
554+
$result['isOwningSide'],
555+
'HasOne relation is an inversed one-to-one, but resulted in the owning side.'
554556
);
555557
}
556558

@@ -703,21 +705,21 @@ public function test_entity_listeners_can_be_configured_through_a_callable()
703705
[
704706
'class' => StubEntityListener::class,
705707
'method' => 'swipeFloor',
706-
]
708+
],
707709
], $this->fluent->getClassMetadata()->entityListeners['onFlush']);
708710

709711
$this->assertEquals([
710712
[
711713
'class' => StubEntityListener::class,
712714
'method' => 'cleanToilet',
713-
]
715+
],
714716
], $this->fluent->getClassMetadata()->entityListeners['postFlush']);
715717

716718
$this->assertEquals([
717719
[
718720
'class' => StubEntityListener::class,
719721
'method' => 'onClear',
720-
]
722+
],
721723
], $this->fluent->getClassMetadata()->entityListeners['onClear']);
722724
}
723725

@@ -745,8 +747,10 @@ public function test_can_override_many_to_one_association()
745747

746748
$this->fluent->build();
747749

748-
$this->assertEquals('target_id',
749-
$this->fluent->getClassMetadata()->getAssociationMapping('manyToOne')['joinColumns'][0]['name']);
750+
$this->assertEquals(
751+
'target_id',
752+
$this->fluent->getClassMetadata()->getAssociationMapping('manyToOne')['joinColumns'][0]['name']
753+
);
750754
$this->assertEquals('source_id', $this->fluent->getClassMetadata()
751755
->getAssociationMapping('manyToOne')['joinColumns'][0]['referencedColumnName']);
752756
}
@@ -761,8 +765,10 @@ public function test_can_override_many_to_many_association()
761765

762766
$this->fluent->build();
763767

764-
$this->assertEquals('custom_table_name',
765-
$this->fluent->getClassMetadata()->getAssociationMapping('manyToMany')['joinTable']['name']);
768+
$this->assertEquals(
769+
'custom_table_name',
770+
$this->fluent->getClassMetadata()->getAssociationMapping('manyToMany')['joinTable']['name']
771+
);
766772
$this->assertEquals('source_id', $this->fluent->getClassMetadata()
767773
->getAssociationMapping('manyToMany')['joinTable']['joinColumns'][0]['name']);
768774
}
@@ -778,7 +784,7 @@ public function test_can_guess_a_one_to_one_relation_name()
778784
try {
779785
$this->fluent->getClassMetadata()->getAssociationMapping('fluentEntity');
780786
} catch (MappingException $e) {
781-
$this->fail("Could not find default name for the oneToOne relation. " . $e->getMessage());
787+
$this->fail('Could not find default name for the oneToOne relation. '.$e->getMessage());
782788
}
783789
}
784790

@@ -793,7 +799,7 @@ public function test_can_guess_a_has_one_relation_name()
793799
try {
794800
$this->fluent->getClassMetadata()->getAssociationMapping('fluentEntity');
795801
} catch (MappingException $e) {
796-
$this->fail("Could not find default name for the hasOne relation. " . $e->getMessage());
802+
$this->fail('Could not find default name for the hasOne relation. '.$e->getMessage());
797803
}
798804
}
799805

@@ -808,7 +814,7 @@ public function test_can_guess_a_belongs_to_relation_name()
808814
try {
809815
$this->fluent->getClassMetadata()->getAssociationMapping('fluentEntity');
810816
} catch (MappingException $e) {
811-
$this->fail("Could not find default name for the belongsTo relation. " . $e->getMessage());
817+
$this->fail('Could not find default name for the belongsTo relation. '.$e->getMessage());
812818
}
813819
}
814820

@@ -823,7 +829,7 @@ public function test_can_guess_a_one_to_many_relation_name()
823829
try {
824830
$this->fluent->getClassMetadata()->getAssociationMapping('fluentEntities');
825831
} catch (MappingException $e) {
826-
$this->fail("Could not find default name for the oneToMany relation. " . $e->getMessage());
832+
$this->fail('Could not find default name for the oneToMany relation. '.$e->getMessage());
827833
}
828834
}
829835

@@ -838,7 +844,7 @@ public function test_can_guess_a_has_many_relation_name()
838844
try {
839845
$this->fluent->getClassMetadata()->getAssociationMapping('fluentEntities');
840846
} catch (MappingException $e) {
841-
$this->fail("Could not find default name for the hasMany relation. " . $e->getMessage());
847+
$this->fail('Could not find default name for the hasMany relation. '.$e->getMessage());
842848
}
843849
}
844850

@@ -853,7 +859,7 @@ public function test_can_guess_a_many_to_many_relation_name()
853859
try {
854860
$this->fluent->getClassMetadata()->getAssociationMapping('fluentEntities');
855861
} catch (MappingException $e) {
856-
$this->fail("Could not find default name for the manyToMany relation. " . $e->getMessage());
862+
$this->fail('Could not find default name for the manyToMany relation. '.$e->getMessage());
857863
}
858864
}
859865

@@ -868,7 +874,7 @@ public function test_can_guess_a_belongs_to_many_relation_name()
868874
try {
869875
$this->fluent->getClassMetadata()->getAssociationMapping('fluentEntities');
870876
} catch (MappingException $e) {
871-
$this->fail("Could not find default name for the belongsToMany relation. " . $e->getMessage());
877+
$this->fail('Could not find default name for the belongsToMany relation. '.$e->getMessage());
872878
}
873879
}
874880

@@ -909,5 +915,8 @@ protected function getMacroableBuilder()
909915

910916
class FluentEntity
911917
{
912-
protected $id, $name, $fluentEntity, $fluentEntities;
918+
protected $id;
919+
protected $name;
920+
protected $fluentEntity;
921+
protected $fluentEntities;
913922
}

tests/Builders/EmbeddedTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ protected function setUp(): void
2828

2929
$this->embedded = new Embedded(
3030
$this->builder,
31-
new DefaultNamingStrategy,
31+
new DefaultNamingStrategy(),
3232
'field',
3333
FluentEmbeddable::class
3434
);

tests/Builders/EntityListenersTest.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,15 @@ public function test_can_add_event_listeners($event, $listener, $expectedMethod,
5050
);
5151

5252
$this->assertCount(
53-
1, $this->fluent->getClassMetadata()->entityListeners[$event]
53+
1,
54+
$this->fluent->getClassMetadata()->entityListeners[$event]
5455
);
5556

5657
$this->assertEquals([
5758
[
5859
'class' => $listener,
59-
'method' => $expectedMethod
60-
]
60+
'method' => $expectedMethod,
61+
],
6162
], $this->fluent->getClassMetadata()->entityListeners[$event]);
6263
}
6364

@@ -74,18 +75,19 @@ public function test_can_add_multiple_entity_listeners_per_event()
7475
);
7576

7677
$this->assertCount(
77-
2, $this->fluent->getClassMetadata()->entityListeners['onClear']
78+
2,
79+
$this->fluent->getClassMetadata()->entityListeners['onClear']
7880
);
7981

8082
$this->assertEquals([
8183
[
8284
'class' => StubEntityListener::class,
83-
'method' => 'onClear'
85+
'method' => 'onClear',
8486
],
8587
[
8688
'class' => StubEntityListener::class,
87-
'method' => 'handle'
88-
]
89+
'method' => 'handle',
90+
],
8991
], $this->fluent->getClassMetadata()->entityListeners['onClear']);
9092
}
9193

tests/Builders/EntityTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
class EntityTest extends TestCase
1414
{
15-
use IsMacroable, MockeryPHPUnitIntegration;
15+
use IsMacroable;
16+
use MockeryPHPUnitIntegration;
1617

1718
/**
1819
* @var ClassMetadataBuilder
@@ -27,7 +28,7 @@ class EntityTest extends TestCase
2728
protected function setUp(): void
2829
{
2930
$this->builder = new ClassMetadataBuilder(new ClassMetadataInfo(StubEntity::class));
30-
$this->entity = new Entity($this->builder);
31+
$this->entity = new Entity($this->builder);
3132
}
3233

3334
public function test_can_set_repository_class()

0 commit comments

Comments
 (0)