From 6d6af870d46e16b68350af1c8220a005442c0d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Tue, 3 Mar 2020 17:21:00 +0100 Subject: [PATCH 1/2] Enhancement: Enable and configure no_extra_blank_lines fixer --- .php_cs.dist | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.php_cs.dist b/.php_cs.dist index 7ba1a9b..d2fbafe 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -9,6 +9,23 @@ return PhpCsFixer\Config::create() 'array_syntax' => [ 'syntax' => 'short', ], + 'no_extra_blank_lines' => [ + 'tokens' => [ + 'break', + 'case', + 'continue', + 'curly_brace_block', + 'default', + 'extra', + 'parenthesis_brace_block', + 'return', + 'square_brace_block', + 'switch', + 'throw', + 'use', + 'use_trait', + ], + ], 'no_whitespace_in_blank_line' => true, 'php_unit_set_up_tear_down_visibility' => true, 'visibility_required' => [ From 0bc2027f3b12d576ffd4086fea5c3b88a178e66a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Tue, 3 Mar 2020 17:22:34 +0100 Subject: [PATCH 2/2] Fix: Run 'php-cs-fixer fix' --- src/Provider/Doctrine/DBAL/Types/StatusArrayType.php | 2 -- src/Provider/Doctrine/DateIntervalHelper.php | 1 - src/Provider/Doctrine/FixtureFactory.php | 4 ---- tests/Provider/Doctrine/FixtureFactoryTest.php | 1 - tests/Provider/Doctrine/Fixtures/TestEntity/Badge.php | 1 - tests/Provider/Doctrine/Fixtures/TestEntity/Person.php | 1 - tests/Provider/Doctrine/Fixtures/TestEntity/SpaceShip.php | 1 - tests/Provider/Doctrine/Types/StatusArrayTest.php | 8 -------- 8 files changed, 19 deletions(-) diff --git a/src/Provider/Doctrine/DBAL/Types/StatusArrayType.php b/src/Provider/Doctrine/DBAL/Types/StatusArrayType.php index dd79bbe..c27cb97 100644 --- a/src/Provider/Doctrine/DBAL/Types/StatusArrayType.php +++ b/src/Provider/Doctrine/DBAL/Types/StatusArrayType.php @@ -53,14 +53,12 @@ public function convertToPHPValue($value, \Doctrine\DBAL\Platforms\AbstractPlatf return null; } - $ret = explode(';', $value); array_walk($ret, function (&$unwashed) { $unwashed = trim($unwashed, '[]'); }); - return $ret; } diff --git a/src/Provider/Doctrine/DateIntervalHelper.php b/src/Provider/Doctrine/DateIntervalHelper.php index 0d11a68..5ddded3 100644 --- a/src/Provider/Doctrine/DateIntervalHelper.php +++ b/src/Provider/Doctrine/DateIntervalHelper.php @@ -17,7 +17,6 @@ class DateIntervalHelper */ public $negative; - /** * @param \DateTime $time * @param bool|false $negative diff --git a/src/Provider/Doctrine/FixtureFactory.php b/src/Provider/Doctrine/FixtureFactory.php index 65811ab..5a3c52a 100644 --- a/src/Provider/Doctrine/FixtureFactory.php +++ b/src/Provider/Doctrine/FixtureFactory.php @@ -38,7 +38,6 @@ class FixtureFactory */ protected $persist; - public function __construct(EntityManager $em) { $this->em = $em; @@ -65,7 +64,6 @@ public function getEntityNamespace() return $this->entityNamespace; } - /** * Get an entity and its dependencies. * @@ -107,7 +105,6 @@ public function get($name, array $fieldOverrides = []) $config['afterCreate']($ent, $fieldValues); } - if ($this->persist) { $this->em->persist($ent); } @@ -115,7 +112,6 @@ public function get($name, array $fieldOverrides = []) return $ent; } - /** * Get an array of entities and their dependencies. * diff --git a/tests/Provider/Doctrine/FixtureFactoryTest.php b/tests/Provider/Doctrine/FixtureFactoryTest.php index 5eff49a..896c4a7 100644 --- a/tests/Provider/Doctrine/FixtureFactoryTest.php +++ b/tests/Provider/Doctrine/FixtureFactoryTest.php @@ -7,7 +7,6 @@ use Doctrine\ORM\EntityManager; use FactoryGirl\Provider\Doctrine\EntityDefinitionUnavailable; use FactoryGirl\Provider\Doctrine\FixtureFactory; - use PHPUnit\Framework; /** diff --git a/tests/Provider/Doctrine/Fixtures/TestEntity/Badge.php b/tests/Provider/Doctrine/Fixtures/TestEntity/Badge.php index 01d6795..e964246 100644 --- a/tests/Provider/Doctrine/Fixtures/TestEntity/Badge.php +++ b/tests/Provider/Doctrine/Fixtures/TestEntity/Badge.php @@ -22,7 +22,6 @@ class Badge */ protected $owner; - public function __construct($label, Person $owner) { $this->label = $label; diff --git a/tests/Provider/Doctrine/Fixtures/TestEntity/Person.php b/tests/Provider/Doctrine/Fixtures/TestEntity/Person.php index a7086da..ecb5996 100644 --- a/tests/Provider/Doctrine/Fixtures/TestEntity/Person.php +++ b/tests/Provider/Doctrine/Fixtures/TestEntity/Person.php @@ -22,7 +22,6 @@ class Person */ protected $spaceShip; - public function __construct($name, SpaceShip $spaceShip = null) { $this->name = $name; diff --git a/tests/Provider/Doctrine/Fixtures/TestEntity/SpaceShip.php b/tests/Provider/Doctrine/Fixtures/TestEntity/SpaceShip.php index 37bc48a..e867e89 100644 --- a/tests/Provider/Doctrine/Fixtures/TestEntity/SpaceShip.php +++ b/tests/Provider/Doctrine/Fixtures/TestEntity/SpaceShip.php @@ -28,7 +28,6 @@ class SpaceShip */ protected $constructorWasCalled = false; - public function __construct($name) { $this->name = $name; diff --git a/tests/Provider/Doctrine/Types/StatusArrayTest.php b/tests/Provider/Doctrine/Types/StatusArrayTest.php index 14d8c02..5301336 100644 --- a/tests/Provider/Doctrine/Types/StatusArrayTest.php +++ b/tests/Provider/Doctrine/Types/StatusArrayTest.php @@ -31,7 +31,6 @@ public function getNameShouldReturnExpectedName() $this->assertSame('statusarray', $this->type->getName()); } - /** * @test */ @@ -41,7 +40,6 @@ public function nullShouldAlwaysConvertToNull() $this->assertNull($this->type->convertToPHPValue(null, $this->platform)); } - /** * @test */ @@ -53,7 +51,6 @@ public function nonArrayOrNotNullShouldFailDatabaseConversion() $this->type->convertToDatabaseValue($value, $this->platform); } - public function provideStupidValues() { return [ @@ -63,7 +60,6 @@ public function provideStupidValues() ]; } - public function provideAcceptableValues() { return [ @@ -78,7 +74,6 @@ public function provideAcceptableValues() ]; } - /** * @test * @dataProvider provideStupidValues @@ -91,7 +86,6 @@ public function invalidCharactersShouldFailDatabaseConversion($stupidValue) $this->type->convertToDatabaseValue($value, $this->platform); } - /** * @test * @dataProvider provideAcceptableValues @@ -102,7 +96,6 @@ public function acceptableCharactersShouldPassDatabaseConversionAndReturnExpecte $this->assertSame($expectedSerialization, $serialization); } - public function provideSerializedValues() { return [ @@ -113,7 +106,6 @@ public function provideSerializedValues() ]; } - /** * @test * @dataProvider provideSerializedValues