mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 05:44:58 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -15,9 +15,6 @@ use Chill\CustomFieldsBundle\Entity\CustomField;
|
||||
use Chill\CustomFieldsBundle\Form\DataTransformer\CustomFieldDataTransformer;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use Symfony\Bundle\TwigBundle\TwigEngine;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
@@ -34,7 +31,7 @@ use Twig\Environment;
|
||||
*/
|
||||
class CustomFieldDate extends AbstractCustomField
|
||||
{
|
||||
final public const DATE_FORMAT = DateTime::RFC3339;
|
||||
final public const DATE_FORMAT = \DateTime::RFC3339;
|
||||
|
||||
final public const FORMAT = 'format';
|
||||
|
||||
@@ -71,8 +68,8 @@ class CustomFieldDate extends AbstractCustomField
|
||||
{
|
||||
$validatorFunction = static function ($value, ExecutionContextInterface $context) {
|
||||
try {
|
||||
$date = new DateTime($value);
|
||||
} catch (Exception) {
|
||||
$date = new \DateTime($value);
|
||||
} catch (\Exception) {
|
||||
$context->buildViolation('The expression "%expression%" is invalid', [
|
||||
'%expression%' => $value,
|
||||
])
|
||||
@@ -107,7 +104,7 @@ class CustomFieldDate extends AbstractCustomField
|
||||
return null;
|
||||
}
|
||||
|
||||
return DateTime::createFromFormat(self::DATE_FORMAT, $serialized);
|
||||
return \DateTime::createFromFormat(self::DATE_FORMAT, $serialized);
|
||||
}
|
||||
|
||||
public function getName()
|
||||
@@ -129,7 +126,7 @@ class CustomFieldDate extends AbstractCustomField
|
||||
|
||||
default:
|
||||
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:date.'
|
||||
. $documentType . '.twig';
|
||||
.$documentType.'.twig';
|
||||
|
||||
return $this->templating
|
||||
->render($template, [
|
||||
@@ -165,7 +162,7 @@ class CustomFieldDate extends AbstractCustomField
|
||||
// add required
|
||||
$fieldOptions['required'] = false;
|
||||
|
||||
//add label
|
||||
// add label
|
||||
$fieldOptions['label'] = $this->translatableStringHelper->localize($customField->getName());
|
||||
|
||||
// add constraints if required
|
||||
@@ -176,8 +173,8 @@ class CustomFieldDate extends AbstractCustomField
|
||||
return;
|
||||
}
|
||||
|
||||
$value = DateTime::createFromFormat(self::DATE_FORMAT, $timestamp);
|
||||
$after = new DateTime($options[self::MIN]);
|
||||
$value = \DateTime::createFromFormat(self::DATE_FORMAT, $timestamp);
|
||||
$after = new \DateTime($options[self::MIN]);
|
||||
|
||||
if ($value < $after) {
|
||||
$context
|
||||
@@ -197,8 +194,8 @@ class CustomFieldDate extends AbstractCustomField
|
||||
return;
|
||||
}
|
||||
|
||||
$value = DateTime::createFromFormat(self::DATE_FORMAT, $timestamp);
|
||||
$before = new DateTime($options[self::MAX]);
|
||||
$value = \DateTime::createFromFormat(self::DATE_FORMAT, $timestamp);
|
||||
$before = new \DateTime($options[self::MAX]);
|
||||
|
||||
if ($value > $before) {
|
||||
$context
|
||||
|
Reference in New Issue
Block a user