From d5395cc0ea98695a6c9ac3169e3b0705c6c01dbb Mon Sep 17 00:00:00 2001 From: William Durand Date: Fri, 4 Dec 2015 09:15:21 +0100 Subject: [PATCH] Fix CS --- Parser/FormTypeParser.php | 12 +++++------- Tests/Fixtures/Form/CollectionType.php | 3 ++- Tests/Fixtures/Form/CompoundType.php | 3 ++- Tests/Fixtures/Form/DependencyType.php | 3 ++- Tests/Fixtures/Form/EntityType.php | 3 ++- Tests/Fixtures/Form/ImprovedTestType.php | 3 ++- Tests/Fixtures/Form/RequireConstructionType.php | 5 +++-- Tests/Fixtures/Form/RequiredType.php | 3 ++- Tests/Fixtures/Form/SimpleType.php | 3 ++- Tests/Fixtures/Form/TestType.php | 3 ++- Tests/Fixtures/RequestParamHelper.php | 6 ++++-- Tests/Parser/FormTypeParserTest.php | 2 +- Tests/WebTestCase.php | 1 - 13 files changed, 29 insertions(+), 21 deletions(-) diff --git a/Parser/FormTypeParser.php b/Parser/FormTypeParser.php index d324d95..6d9b5cd 100644 --- a/Parser/FormTypeParser.php +++ b/Parser/FormTypeParser.php @@ -15,10 +15,7 @@ use Nelmio\ApiDocBundle\DataTypes; use Nelmio\ApiDocBundle\Util\LegacyFormHelper; use Symfony\Component\Form\Exception\FormException; use Symfony\Component\Form\Exception\InvalidArgumentException; -use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\ChoiceList\ChoiceListInterface; -use Symfony\Component\Form\ChoiceList\View\ChoiceListView; -use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface as LegacyChoiceListInterface; use Symfony\Component\Form\Extension\Core\View\ChoiceView; use Symfony\Component\Form\Form; use Symfony\Component\Form\FormFactoryInterface; @@ -108,7 +105,6 @@ class FormTypeParser implements ParserInterface ), ); - public function __construct(FormFactoryInterface $formFactory, $entityToChoice) { $this->formFactory = $formFactory; @@ -154,7 +150,7 @@ class FormTypeParser implements ParserInterface } } - if(!isset($form)) { + if (!isset($form)) { if (!LegacyFormHelper::hasBCBreaks() && $this->implementsType($type)) { $type = $this->getTypeInstance($type); $form = $this->formFactory->create($type, null, $options); @@ -194,7 +190,8 @@ class FormTypeParser implements ParserInterface ); } - private function getDataType($type) { + private function getDataType($type) + { foreach ($this->extendedMapTypes as $data => $types) { if (in_array($type, $types)) { return $data; @@ -410,11 +407,12 @@ class FormTypeParser implements ParserInterface { try { return $this->formFactory->create($type, null, $options); - } catch(InvalidArgumentException $exception) { + } catch (InvalidArgumentException $exception) { } if (!LegacyFormHelper::hasBCBreaks() && !isset($form) && $this->implementsType($type)) { $type = $this->getTypeInstance($type); + return $this->formFactory->create($type, null, $options); } } diff --git a/Tests/Fixtures/Form/CollectionType.php b/Tests/Fixtures/Form/CollectionType.php index 11c8a40..38b23e3 100644 --- a/Tests/Fixtures/Form/CollectionType.php +++ b/Tests/Fixtures/Form/CollectionType.php @@ -46,7 +46,8 @@ class CollectionType extends AbstractType /** * {@inheritdoc} */ - public function getBlockPrefix() { + public function getBlockPrefix() + { return 'collection_type'; } } diff --git a/Tests/Fixtures/Form/CompoundType.php b/Tests/Fixtures/Form/CompoundType.php index 4dad4bf..9083536 100644 --- a/Tests/Fixtures/Form/CompoundType.php +++ b/Tests/Fixtures/Form/CompoundType.php @@ -42,7 +42,8 @@ class CompoundType extends AbstractType /** * {@inheritdoc} */ - public function getBlockPrefix() { + public function getBlockPrefix() + { return ''; } } diff --git a/Tests/Fixtures/Form/DependencyType.php b/Tests/Fixtures/Form/DependencyType.php index 3ed9d88..71491ff 100644 --- a/Tests/Fixtures/Form/DependencyType.php +++ b/Tests/Fixtures/Form/DependencyType.php @@ -66,7 +66,8 @@ class DependencyType extends AbstractType /** * {@inheritdoc} */ - public function getBlockPrefix() { + public function getBlockPrefix() + { return 'dependency_type'; } } diff --git a/Tests/Fixtures/Form/EntityType.php b/Tests/Fixtures/Form/EntityType.php index 4ced4fe..03830c6 100644 --- a/Tests/Fixtures/Form/EntityType.php +++ b/Tests/Fixtures/Form/EntityType.php @@ -59,7 +59,8 @@ class EntityType extends AbstractType /** * {@inheritdoc} */ - public function getBlockPrefix() { + public function getBlockPrefix() + { return 'entity'; } } diff --git a/Tests/Fixtures/Form/ImprovedTestType.php b/Tests/Fixtures/Form/ImprovedTestType.php index 09a1667..ee8f70b 100644 --- a/Tests/Fixtures/Form/ImprovedTestType.php +++ b/Tests/Fixtures/Form/ImprovedTestType.php @@ -91,7 +91,8 @@ class ImprovedTestType extends AbstractType /** * {@inheritdoc} */ - public function getBlockPrefix() { + public function getBlockPrefix() + { return ''; } } diff --git a/Tests/Fixtures/Form/RequireConstructionType.php b/Tests/Fixtures/Form/RequireConstructionType.php index 9e4ccc8..9d706e6 100644 --- a/Tests/Fixtures/Form/RequireConstructionType.php +++ b/Tests/Fixtures/Form/RequireConstructionType.php @@ -59,7 +59,7 @@ class RequireConstructionType extends AbstractType return; } - + /** * BC SF < 2.8 * {@inheritdoc} @@ -72,7 +72,8 @@ class RequireConstructionType extends AbstractType /** * {@inheritdoc} */ - public function getBlockPrefix() { + public function getBlockPrefix() + { return 'require_construction_type'; } } diff --git a/Tests/Fixtures/Form/RequiredType.php b/Tests/Fixtures/Form/RequiredType.php index 80e2e33..04ec105 100644 --- a/Tests/Fixtures/Form/RequiredType.php +++ b/Tests/Fixtures/Form/RequiredType.php @@ -39,7 +39,8 @@ class RequiredType extends AbstractType /** * {@inheritdoc} */ - public function getBlockPrefix() { + public function getBlockPrefix() + { return ''; } } diff --git a/Tests/Fixtures/Form/SimpleType.php b/Tests/Fixtures/Form/SimpleType.php index f077327..82a0d4f 100644 --- a/Tests/Fixtures/Form/SimpleType.php +++ b/Tests/Fixtures/Form/SimpleType.php @@ -50,7 +50,8 @@ class SimpleType extends AbstractType /** * {@inheritdoc} */ - public function getBlockPrefix() { + public function getBlockPrefix() + { return 'simple'; } } diff --git a/Tests/Fixtures/Form/TestType.php b/Tests/Fixtures/Form/TestType.php index bbe75f8..6f2923f 100644 --- a/Tests/Fixtures/Form/TestType.php +++ b/Tests/Fixtures/Form/TestType.php @@ -66,7 +66,8 @@ class TestType extends AbstractType /** * {@inheritdoc} */ - public function getBlockPrefix() { + public function getBlockPrefix() + { return ''; } } diff --git a/Tests/Fixtures/RequestParamHelper.php b/Tests/Fixtures/RequestParamHelper.php index 43d3c3d..d8f6a9d 100644 --- a/Tests/Fixtures/RequestParamHelper.php +++ b/Tests/Fixtures/RequestParamHelper.php @@ -12,8 +12,10 @@ use FOS\RestBundle\Controller\Annotations\RequestParam; * * @author Ener-Getick */ -class RequestParamHelper extends RequestParam { - public function __construct(array $data) { +class RequestParamHelper extends RequestParam +{ + public function __construct(array $data) + { foreach ($data as $key => $value) { if ($key === 'array') { if (property_exists($this, 'map')) { diff --git a/Tests/Parser/FormTypeParserTest.php b/Tests/Parser/FormTypeParserTest.php index 3a5521e..22bfca5 100644 --- a/Tests/Parser/FormTypeParserTest.php +++ b/Tests/Parser/FormTypeParserTest.php @@ -54,7 +54,7 @@ class FormTypeParserTest extends \PHPUnit_Framework_TestCase */ public function testLegacyParse($typeName, $expected) { - if(LegacyFormHelper::hasBCBreaks()) { + if (LegacyFormHelper::hasBCBreaks()) { $this->markTestSkipped('Not supported on symfony 3.0.'); } diff --git a/Tests/WebTestCase.php b/Tests/WebTestCase.php index 186f4ab..9f7ebc3 100644 --- a/Tests/WebTestCase.php +++ b/Tests/WebTestCase.php @@ -12,7 +12,6 @@ namespace Nelmio\ApiDocBundle\Tests; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase; -use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpKernel\Kernel; abstract class WebTestCase extends BaseWebTestCase