[Form] cs fixes in date types
This commit is contained in:
parent
09cc0b20d5
commit
bc21828838
@ -198,7 +198,7 @@ class DateTimeType extends AbstractType
|
|||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||||
{
|
{
|
||||||
$compound = function (Options $options) {
|
$compound = function (Options $options) {
|
||||||
return $options['widget'] !== 'single_text';
|
return 'single_text' !== $options['widget'];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Defaults to the value of "widget"
|
// Defaults to the value of "widget"
|
||||||
|
@ -78,7 +78,7 @@ class DateType extends AbstractType
|
|||||||
$pattern
|
$pattern
|
||||||
);
|
);
|
||||||
|
|
||||||
// new \intlDateFormatter may return null instead of false in case of failure, see https://bugs.php.net/bug.php?id=66323
|
// new \IntlDateFormatter may return null instead of false in case of failure, see https://bugs.php.net/bug.php?id=66323
|
||||||
if (!$formatter) {
|
if (!$formatter) {
|
||||||
throw new InvalidOptionsException(intl_get_error_message(), intl_get_error_code());
|
throw new InvalidOptionsException(intl_get_error_message(), intl_get_error_code());
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ class DateType extends AbstractType
|
|||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||||
{
|
{
|
||||||
$compound = function (Options $options) {
|
$compound = function (Options $options) {
|
||||||
return $options['widget'] !== 'single_text';
|
return 'single_text' !== $options['widget'];
|
||||||
};
|
};
|
||||||
|
|
||||||
$emptyValue = $emptyValueDefault = function (Options $options) {
|
$emptyValue = $emptyValueDefault = function (Options $options) {
|
||||||
@ -196,7 +196,7 @@ class DateType extends AbstractType
|
|||||||
};
|
};
|
||||||
|
|
||||||
$format = function (Options $options) {
|
$format = function (Options $options) {
|
||||||
return $options['widget'] === 'single_text' ? DateType::HTML5_FORMAT : DateType::DEFAULT_FORMAT;
|
return 'single_text' === $options['widget'] ? DateType::HTML5_FORMAT : DateType::DEFAULT_FORMAT;
|
||||||
};
|
};
|
||||||
|
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults(array(
|
||||||
|
@ -157,7 +157,7 @@ class TimeType extends AbstractType
|
|||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||||
{
|
{
|
||||||
$compound = function (Options $options) {
|
$compound = function (Options $options) {
|
||||||
return $options['widget'] !== 'single_text';
|
return 'single_text' !== $options['widget'];
|
||||||
};
|
};
|
||||||
|
|
||||||
$emptyValue = $emptyValueDefault = function (Options $options) {
|
$emptyValue = $emptyValueDefault = function (Options $options) {
|
||||||
|
Reference in New Issue
Block a user