mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-09 02:59:27 +03:00
codestyle fixes
This commit is contained in:
parent
6e41a20e40
commit
b405b33ea2
@ -20,9 +20,6 @@ trait ModelRegistryAwareTrait
|
||||
*/
|
||||
private $modelRegistry;
|
||||
|
||||
/**
|
||||
* @param ModelRegistry $modelRegistry
|
||||
*/
|
||||
public function setModelRegistry(ModelRegistry $modelRegistry)
|
||||
{
|
||||
$this->modelRegistry = $modelRegistry;
|
||||
|
@ -116,11 +116,8 @@ final class FormModelDescriber implements ModelDescriberInterface, ModelRegistry
|
||||
break;
|
||||
}
|
||||
|
||||
if (
|
||||
($formType = $type->getInnerType()) &&
|
||||
($formClass = get_class($formType)) &&
|
||||
!$this->isBuiltinType($formClass) //don't check builtin types in Form component.
|
||||
) {
|
||||
if ($type->getInnerType() && ($formClass = get_class($type->getInnerType())) && !$this->isBuiltinType($formClass)) {
|
||||
//if form type is not builtin in Form component.
|
||||
$model = new Model(new Type(Type::BUILTIN_TYPE_OBJECT, false, $formClass));
|
||||
$property->setRef($this->modelRegistry->register($model));
|
||||
break;
|
||||
@ -136,13 +133,8 @@ final class FormModelDescriber implements ModelDescriberInterface, ModelRegistry
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isBuiltinType(string $type) : bool
|
||||
private function isBuiltinType(string $type): bool
|
||||
{
|
||||
return strpos($type, 'Symfony\Component\Form\Extension\Core\Type') !== false;
|
||||
return 0 === strpos($type, 'Symfony\Component\Form\Extension\Core\Type');
|
||||
}
|
||||
}
|
||||
|
@ -18,9 +18,9 @@ use Nelmio\ApiDocBundle\Annotation\Operation;
|
||||
use Nelmio\ApiDocBundle\Tests\Functional\Entity\Article;
|
||||
use Nelmio\ApiDocBundle\Tests\Functional\Entity\User;
|
||||
use Nelmio\ApiDocBundle\Tests\Functional\Form\DummyType;
|
||||
use Nelmio\ApiDocBundle\Tests\Functional\Form\UserType;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Swagger\Annotations as SWG;
|
||||
use Nelmio\ApiDocBundle\Tests\Functional\Form\UserType;
|
||||
|
||||
/**
|
||||
* @Route("/api")
|
||||
|
@ -1,11 +1,20 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the NelmioApiDocBundle package.
|
||||
*
|
||||
* (c) Nelmio
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Nelmio\ApiDocBundle\Tests\Functional\Form;
|
||||
|
||||
use Nelmio\ApiDocBundle\Tests\Functional\Entity\User;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Nelmio\ApiDocBundle\Tests\Functional\Entity\User;
|
||||
|
||||
class UserType extends AbstractType
|
||||
{
|
||||
@ -17,7 +26,7 @@ class UserType extends AbstractType
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => User::class
|
||||
'data_class' => User::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ class FunctionalTest extends WebTestCase
|
||||
$this->assertEquals([
|
||||
'type' => 'object',
|
||||
'properties' => [
|
||||
'dummy' => ['$ref' => '#/definitions/DummyType']
|
||||
'dummy' => ['$ref' => '#/definitions/DummyType'],
|
||||
],
|
||||
'required' => ['dummy'],
|
||||
], $this->getModel('UserType')->toArray());
|
||||
|
Loading…
x
Reference in New Issue
Block a user