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