Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed Dec 4, 2015
1 parent 1df3ddf commit d5395cc
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 21 deletions.
12 changes: 5 additions & 7 deletions Parser/FormTypeParser.php
Expand Up @@ -15,10 +15,7 @@
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;
Expand Down Expand Up @@ -108,7 +105,6 @@ class FormTypeParser implements ParserInterface
),
);


public function __construct(FormFactoryInterface $formFactory, $entityToChoice)
{
$this->formFactory = $formFactory;
Expand Down Expand Up @@ -154,7 +150,7 @@ public function parse(array $item)
}
}

if(!isset($form)) {
if (!isset($form)) {
if (!LegacyFormHelper::hasBCBreaks() && $this->implementsType($type)) {
$type = $this->getTypeInstance($type);
$form = $this->formFactory->create($type, null, $options);
Expand Down Expand Up @@ -194,7 +190,8 @@ public function parse(array $item)
);
}

private function getDataType($type) {
private function getDataType($type)
{
foreach ($this->extendedMapTypes as $data => $types) {
if (in_array($type, $types)) {
return $data;
Expand Down Expand Up @@ -410,11 +407,12 @@ private function createForm($type, $data = null, array $options = array())
{
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);
}
}
Expand Down
3 changes: 2 additions & 1 deletion Tests/Fixtures/Form/CollectionType.php
Expand Up @@ -46,7 +46,8 @@ public function getName()
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return 'collection_type';
}
}
3 changes: 2 additions & 1 deletion Tests/Fixtures/Form/CompoundType.php
Expand Up @@ -42,7 +42,8 @@ public function getName()
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return '';
}
}
3 changes: 2 additions & 1 deletion Tests/Fixtures/Form/DependencyType.php
Expand Up @@ -66,7 +66,8 @@ public function getName()
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return 'dependency_type';
}
}
3 changes: 2 additions & 1 deletion Tests/Fixtures/Form/EntityType.php
Expand Up @@ -59,7 +59,8 @@ public function getName()
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return 'entity';
}
}
3 changes: 2 additions & 1 deletion Tests/Fixtures/Form/ImprovedTestType.php
Expand Up @@ -91,7 +91,8 @@ public function getName()
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return '';
}
}
5 changes: 3 additions & 2 deletions Tests/Fixtures/Form/RequireConstructionType.php
Expand Up @@ -59,7 +59,7 @@ public function configureOptions(OptionsResolver $resolver)

return;
}

/**
* BC SF < 2.8
* {@inheritdoc}
Expand All @@ -72,7 +72,8 @@ public function getName()
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return 'require_construction_type';
}
}
3 changes: 2 additions & 1 deletion Tests/Fixtures/Form/RequiredType.php
Expand Up @@ -39,7 +39,8 @@ public function getName()
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return '';
}
}
3 changes: 2 additions & 1 deletion Tests/Fixtures/Form/SimpleType.php
Expand Up @@ -50,7 +50,8 @@ public function getName()
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return 'simple';
}
}
3 changes: 2 additions & 1 deletion Tests/Fixtures/Form/TestType.php
Expand Up @@ -66,7 +66,8 @@ public function getName()
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return '';
}
}
6 changes: 4 additions & 2 deletions Tests/Fixtures/RequestParamHelper.php
Expand Up @@ -12,8 +12,10 @@
*
* @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')) {
Expand Down
2 changes: 1 addition & 1 deletion Tests/Parser/FormTypeParserTest.php
Expand Up @@ -54,7 +54,7 @@ public function testParse($typeName, $expected)
*/
public function testLegacyParse($typeName, $expected)
{
if(LegacyFormHelper::hasBCBreaks()) {
if (LegacyFormHelper::hasBCBreaks()) {
$this->markTestSkipped('Not supported on symfony 3.0.');
}

Expand Down
1 change: 0 additions & 1 deletion Tests/WebTestCase.php
Expand Up @@ -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
Expand Down

0 comments on commit d5395cc

Please sign in to comment.