fixed CS, phpdoc, removed unused use statements
This commit is contained in:
parent
5e0823c99c
commit
916597eb29
@ -11,10 +11,8 @@
|
|||||||
|
|
||||||
namespace Symfony\Bridge\Doctrine\Form\ChoiceList;
|
namespace Symfony\Bridge\Doctrine\Form\ChoiceList;
|
||||||
|
|
||||||
use Symfony\Component\Form\Util\PropertyPath;
|
|
||||||
use Symfony\Component\Form\Exception\FormException;
|
use Symfony\Component\Form\Exception\FormException;
|
||||||
use Symfony\Component\Form\Exception\StringCastException;
|
use Symfony\Component\Form\Exception\StringCastException;
|
||||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
|
||||||
use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
|
use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
|
||||||
use Doctrine\Common\Persistence\ObjectManager;
|
use Doctrine\Common\Persistence\ObjectManager;
|
||||||
|
|
||||||
|
@ -11,9 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bridge\Doctrine\Form\DataTransformer;
|
namespace Symfony\Bridge\Doctrine\Form\DataTransformer;
|
||||||
|
|
||||||
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList;
|
|
||||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
|
||||||
use Symfony\Component\Form\DataTransformerInterface;
|
use Symfony\Component\Form\DataTransformerInterface;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
@ -46,7 +44,7 @@ class CollectionToArrayTransformer implements DataTransformerInterface
|
|||||||
/**
|
/**
|
||||||
* Transforms choice keys into entities.
|
* Transforms choice keys into entities.
|
||||||
*
|
*
|
||||||
* @param mixed $keys An array of entities
|
* @param mixed $array An array of entities
|
||||||
*
|
*
|
||||||
* @return Collection A collection of entities
|
* @return Collection A collection of entities
|
||||||
*/
|
*/
|
||||||
|
@ -68,4 +68,4 @@
|
|||||||
<em>No logs available.</em>
|
<em>No logs available.</em>
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -469,6 +469,7 @@ class FormFieldRegistry
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->get($name);
|
$this->get($name);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
namespace Symfony\Component\Form\Extension\Core\ChoiceList;
|
namespace Symfony\Component\Form\Extension\Core\ChoiceList;
|
||||||
|
|
||||||
use Symfony\Component\Form\Form;
|
use Symfony\Component\Form\Form;
|
||||||
use Symfony\Component\Form\Util\FormUtil;
|
|
||||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||||
use Symfony\Component\Form\Exception\InvalidConfigurationException;
|
use Symfony\Component\Form\Exception\InvalidConfigurationException;
|
||||||
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
|
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
|
||||||
@ -98,19 +97,19 @@ class ChoiceList implements ChoiceListInterface
|
|||||||
/**
|
/**
|
||||||
* Creates a new choice list.
|
* Creates a new choice list.
|
||||||
*
|
*
|
||||||
* @param array|\Traversable $choices The array of choices. Choices may also be given
|
* @param array|\Traversable $choices The array of choices. Choices may also be given
|
||||||
* as hierarchy of unlimited depth. Hierarchies are
|
* as hierarchy of unlimited depth. Hierarchies are
|
||||||
* created by creating nested arrays. The title of
|
* created by creating nested arrays. The title of
|
||||||
* the sub-hierarchy can be stored in the array
|
* the sub-hierarchy can be stored in the array
|
||||||
* key pointing to the nested array.
|
* key pointing to the nested array.
|
||||||
* @param array $labels The array of labels. The structure of this array
|
* @param array $labels The array of labels. The structure of this array
|
||||||
* should match the structure of $choices.
|
* should match the structure of $choices.
|
||||||
* @param array $preferredChoices A flat array of choices that should be
|
* @param array $preferredChoices A flat array of choices that should be
|
||||||
* presented to the user with priority.
|
* presented to the user with priority.
|
||||||
* @param integer $valueStrategy The strategy used to create choice values.
|
* @param integer $valueStrategy The strategy used to create choice values.
|
||||||
* One of COPY_CHOICE and GENERATE.
|
* One of COPY_CHOICE and GENERATE.
|
||||||
* @param integer $indexStrategy The strategy used to create choice indices.
|
* @param integer $indexStrategy The strategy used to create choice indices.
|
||||||
* One of COPY_CHOICE and GENERATE.
|
* One of COPY_CHOICE and GENERATE.
|
||||||
*/
|
*/
|
||||||
public function __construct($choices, array $labels, array $preferredChoices = array(), $valueStrategy = self::GENERATE, $indexStrategy = self::GENERATE)
|
public function __construct($choices, array $labels, array $preferredChoices = array(), $valueStrategy = self::GENERATE, $indexStrategy = self::GENERATE)
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Form\Extension\Core\ChoiceList;
|
namespace Symfony\Component\Form\Extension\Core\ChoiceList;
|
||||||
|
|
||||||
use Symfony\Component\Form\Util\FormUtil;
|
|
||||||
|
|
||||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||||
|
|
||||||
@ -28,19 +27,20 @@ class SimpleChoiceList extends ChoiceList
|
|||||||
/**
|
/**
|
||||||
* Creates a new simple choice list.
|
* Creates a new simple choice list.
|
||||||
*
|
*
|
||||||
* @param array $choices The array of choices with the choices as keys and
|
* @param array $choices The array of choices with the choices as keys and
|
||||||
* the labels as values. Choices may also be given
|
* the labels as values. Choices may also be given
|
||||||
* as hierarchy of unlimited depth. Hierarchies are
|
* as hierarchy of unlimited depth. Hierarchies are
|
||||||
* created by creating nested arrays. The title of
|
* created by creating nested arrays. The title of
|
||||||
* the sub-hierarchy is stored in the array
|
* the sub-hierarchy is stored in the array
|
||||||
* key pointing to the nested array.
|
* key pointing to the nested array.
|
||||||
* @param array $preferredChoices A flat array of choices that should be
|
* @param array $preferredChoices A flat array of choices that should be
|
||||||
* presented to the user with priority.
|
* presented to the user with priority.
|
||||||
* @param integer $indexStrategy The strategy used to create choice indices.
|
* @param integer $valueStrategy The strategy used to create choice values.
|
||||||
* One of COPY_CHOICE and GENERATE.
|
* One of COPY_CHOICE and GENERATE.
|
||||||
|
* @param integer $indexStrategy The strategy used to create choice indices.
|
||||||
|
* One of COPY_CHOICE and GENERATE.
|
||||||
*/
|
*/
|
||||||
public function __construct(array $choices, array $preferredChoices = array(),
|
public function __construct(array $choices, array $preferredChoices = array(), $valueStrategy = self::COPY_CHOICE, $indexStrategy = self::GENERATE)
|
||||||
$valueStrategy = self::COPY_CHOICE, $indexStrategy = self::GENERATE)
|
|
||||||
{
|
{
|
||||||
// Flip preferred choices to speed up lookup
|
// Flip preferred choices to speed up lookup
|
||||||
parent::__construct($choices, $choices, array_flip($preferredChoices), $valueStrategy, $indexStrategy);
|
parent::__construct($choices, $choices, array_flip($preferredChoices), $valueStrategy, $indexStrategy);
|
||||||
|
@ -15,7 +15,6 @@ use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
|
|||||||
use Symfony\Component\Form\DataTransformerInterface;
|
use Symfony\Component\Form\DataTransformerInterface;
|
||||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||||
use Symfony\Component\Form\Util\FormUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
@ -42,10 +41,10 @@ class ChoiceToBooleanArrayTransformer implements DataTransformerInterface
|
|||||||
* depending on whether a given option is selected. If this field is rendered
|
* depending on whether a given option is selected. If this field is rendered
|
||||||
* as select tag, the value is not modified.
|
* as select tag, the value is not modified.
|
||||||
*
|
*
|
||||||
* @param mixed $value An array if "multiple" is set to true, a scalar
|
* @param mixed $choice An array if "multiple" is set to true, a scalar
|
||||||
* value otherwise.
|
* value otherwise.
|
||||||
*
|
*
|
||||||
* @return mixed An array
|
* @return mixed An array
|
||||||
*
|
*
|
||||||
* @throws UnexpectedTypeException if the given value is not scalar
|
* @throws UnexpectedTypeException if the given value is not scalar
|
||||||
* @throws TransformationFailedException if the choices can not be retrieved
|
* @throws TransformationFailedException if the choices can not be retrieved
|
||||||
@ -74,9 +73,9 @@ class ChoiceToBooleanArrayTransformer implements DataTransformerInterface
|
|||||||
* values, depending on whether a given choice is selected. The output
|
* values, depending on whether a given choice is selected. The output
|
||||||
* is the selected choice.
|
* is the selected choice.
|
||||||
*
|
*
|
||||||
* @param array $value An array of values
|
* @param array $values An array of values
|
||||||
*
|
*
|
||||||
* @return mixed $value A scalar value
|
* @return mixed A scalar value
|
||||||
*
|
*
|
||||||
* @throws new UnexpectedTypeException if the given value is not an array
|
* @throws new UnexpectedTypeException if the given value is not an array
|
||||||
*/
|
*/
|
||||||
|
@ -38,7 +38,7 @@ class ChoicesToBooleanArrayTransformer implements DataTransformerInterface
|
|||||||
*
|
*
|
||||||
* @param mixed $array An array
|
* @param mixed $array An array
|
||||||
*
|
*
|
||||||
* @return mixed An array
|
* @return mixed An array
|
||||||
*
|
*
|
||||||
* @throws UnexpectedTypeException if the given value is not an array
|
* @throws UnexpectedTypeException if the given value is not an array
|
||||||
* @throws TransformationFailedException if the choices can not be retrieved
|
* @throws TransformationFailedException if the choices can not be retrieved
|
||||||
@ -75,9 +75,9 @@ class ChoicesToBooleanArrayTransformer implements DataTransformerInterface
|
|||||||
* values, depending on whether a given choice is selected. The output
|
* values, depending on whether a given choice is selected. The output
|
||||||
* is an array with the selected choices.
|
* is an array with the selected choices.
|
||||||
*
|
*
|
||||||
* @param mixed $value An array
|
* @param mixed $values An array
|
||||||
*
|
*
|
||||||
* @return mixed $value An array
|
* @return mixed An array
|
||||||
*
|
*
|
||||||
* @throws UnexpectedTypeException if the given value is not an array
|
* @throws UnexpectedTypeException if the given value is not an array
|
||||||
*/
|
*/
|
||||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\Form\Extension\Core\DataTransformer;
|
|||||||
|
|
||||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||||
|
|
||||||
use Symfony\Component\Form\Util\FormUtil;
|
|
||||||
use Symfony\Component\Form\DataTransformerInterface;
|
use Symfony\Component\Form\DataTransformerInterface;
|
||||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||||
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
|
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
|
||||||
|
@ -15,10 +15,8 @@ use Symfony\Component\Form\AbstractType;
|
|||||||
use Symfony\Component\Form\FormBuilder;
|
use Symfony\Component\Form\FormBuilder;
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
use Symfony\Component\Form\Exception\FormException;
|
use Symfony\Component\Form\Exception\FormException;
|
||||||
use Symfony\Component\Form\Extension\Core\ChoiceList\Loader\ChoiceListLoaderInterface;
|
|
||||||
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList;
|
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList;
|
||||||
use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
|
use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
|
||||||
use Symfony\Component\Form\Extension\Core\ChoiceList\LazyChoiceList;
|
|
||||||
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
|
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
|
||||||
use Symfony\Component\Form\Extension\Core\EventListener\FixRadioInputListener;
|
use Symfony\Component\Form\Extension\Core\EventListener\FixRadioInputListener;
|
||||||
use Symfony\Component\Form\FormView;
|
use Symfony\Component\Form\FormView;
|
||||||
|
@ -17,7 +17,6 @@ use Symfony\Component\Form\AbstractType;
|
|||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
use Symfony\Component\Form\FormBuilder;
|
use Symfony\Component\Form\FormBuilder;
|
||||||
use Symfony\Component\Form\Exception\CreationException;
|
use Symfony\Component\Form\Exception\CreationException;
|
||||||
use Symfony\Component\Form\Extension\Core\ChoiceList\Loader\MonthChoiceListLoader;
|
|
||||||
use Symfony\Component\Form\FormView;
|
use Symfony\Component\Form\FormView;
|
||||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer;
|
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer;
|
||||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
|
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
|
||||||
|
@ -13,8 +13,6 @@ namespace Symfony\Component\Form\Extension\Core\Type;
|
|||||||
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
use Symfony\Component\Form\FormBuilder;
|
|
||||||
use Symfony\Component\Form\Extension\Core\DataTransformer\BooleanToStringTransformer;
|
|
||||||
use Symfony\Component\Form\FormView;
|
use Symfony\Component\Form\FormView;
|
||||||
|
|
||||||
class RadioType extends AbstractType
|
class RadioType extends AbstractType
|
||||||
|
@ -63,4 +63,4 @@ class ChoiceView
|
|||||||
{
|
{
|
||||||
return $this->label;
|
return $this->label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,9 +48,9 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the child with the given name.
|
* Returns the child with the given name.
|
||||||
*
|
*
|
||||||
* @param string $name The name of the child
|
* @param string $name The name of the child
|
||||||
*
|
*
|
||||||
* @return FormInterface The child form
|
* @return FormInterface The child form
|
||||||
*/
|
*/
|
||||||
function get($name);
|
function get($name);
|
||||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\HttpKernel\Debug;
|
|||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\Exception\FlattenException;
|
use Symfony\Component\HttpKernel\Exception\FlattenException;
|
||||||
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
|
||||||
|
|
||||||
if (!defined('ENT_SUBSTITUTE')) {
|
if (!defined('ENT_SUBSTITUTE')) {
|
||||||
define('ENT_SUBSTITUTE', 8);
|
define('ENT_SUBSTITUTE', 8);
|
||||||
|
@ -108,6 +108,7 @@ class FormTest extends \PHPUnit_Framework_TestCase
|
|||||||
$values,
|
$values,
|
||||||
array_map(function ($field) {
|
array_map(function ($field) {
|
||||||
$class = get_class($field);
|
$class = get_class($field);
|
||||||
|
|
||||||
return array(substr($class, strrpos($class, '\\') + 1), $field->getValue());
|
return array(substr($class, strrpos($class, '\\') + 1), $field->getValue());
|
||||||
},
|
},
|
||||||
$form->all()
|
$form->all()
|
||||||
|
@ -12,9 +12,7 @@
|
|||||||
namespace Symfony\Tests\Component\Form\Extension\Core\Type;
|
namespace Symfony\Tests\Component\Form\Extension\Core\Type;
|
||||||
|
|
||||||
use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
|
use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
|
||||||
use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
|
|
||||||
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
|
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
|
||||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
|
||||||
|
|
||||||
class ChoiceTypeTest extends TypeTestCase
|
class ChoiceTypeTest extends TypeTestCase
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user