This commit is contained in:
William Durand 2015-12-04 09:15:21 +01:00
parent 1df3ddf49f
commit d5395cc0ea
No known key found for this signature in database
GPG Key ID: A509BCF1C1274F3B
13 changed files with 29 additions and 21 deletions

View File

@ -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);
}
}

View File

@ -46,7 +46,8 @@ class CollectionType extends AbstractType
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return 'collection_type';
}
}

View File

@ -42,7 +42,8 @@ class CompoundType extends AbstractType
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return '';
}
}

View File

@ -66,7 +66,8 @@ class DependencyType extends AbstractType
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return 'dependency_type';
}
}

View File

@ -59,7 +59,8 @@ class EntityType extends AbstractType
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return 'entity';
}
}

View File

@ -91,7 +91,8 @@ class ImprovedTestType extends AbstractType
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return '';
}
}

View File

@ -72,7 +72,8 @@ class RequireConstructionType extends AbstractType
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return 'require_construction_type';
}
}

View File

@ -39,7 +39,8 @@ class RequiredType extends AbstractType
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return '';
}
}

View File

@ -50,7 +50,8 @@ class SimpleType extends AbstractType
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return 'simple';
}
}

View File

@ -66,7 +66,8 @@ class TestType extends AbstractType
/**
* {@inheritdoc}
*/
public function getBlockPrefix() {
public function getBlockPrefix()
{
return '';
}
}

View File

@ -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')) {

View File

@ -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.');
}

View File

@ -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