diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 7ac21310..d9a5294c 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -1,5 +1,16 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + /* * DO NOT EDIT THIS FILE! * diff --git a/composer.json b/composer.json index 6d61ac09..f7d3bf80 100644 --- a/composer.json +++ b/composer.json @@ -36,6 +36,7 @@ "require-dev": { "doctrine/orm": "^2.0", "doctrine/persistence": "^1.3 || ^2.0", + "friendsofphp/php-cs-fixer": "^3.4", "matthiasnoback/symfony-config-test": "^4.2", "matthiasnoback/symfony-dependency-injection-test": "^4.0", "phpstan/extension-installer": "^1.0", diff --git a/docs/requirements.txt b/docs/requirements.txt index 730a1188..2f1caf08 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -6,3 +6,4 @@ Pygments==2.9.0 sphinx==1.8.5 git+https://github.com/fabpot/sphinx-php.git@v2.0.2#egg_name=sphinx-php sphinx_rtd_theme==0.5.2 +jinja2==3.0.3 diff --git a/src/Date/MomentFormatConverter.php b/src/Date/MomentFormatConverter.php index b445231a..fb10804d 100644 --- a/src/Date/MomentFormatConverter.php +++ b/src/Date/MomentFormatConverter.php @@ -61,19 +61,19 @@ public function convert(string $format): string $size = \strlen($format); $output = ''; - //process the format string letter by letter + // process the format string letter by letter for ($i = 0; $i < $size; ++$i) { - //if finds a ' + // if finds a ' if ("'" === $format[$i]) { - //if the next character are T' forming 'T', send a T to the - //output + // if the next character are T' forming 'T', send a T to the + // output if ('T' === $format[$i + 1] && '\'' === $format[$i + 2]) { $output .= 'T'; $i += 2; } else { - //if it's no a 'T' then send whatever is inside the '' to - //the output, but send it inside [] (useful for cases like - //the brazilian translation that uses a 'de' in the date) + // if it's no a 'T' then send whatever is inside the '' to + // the output, but send it inside [] (useful for cases like + // the brazilian translation that uses a 'de' in the date) $output .= '['; $temp = current(explode("'", substr($format, $i + 1))); $output .= $temp; @@ -81,8 +81,8 @@ public function convert(string $format): string $i += \strlen($temp) + 1; } } else { - //if no ' is found, then search all the rules, see if any of - //them matchs + // if no ' is found, then search all the rules, see if any of + // them matchs $foundOne = false; foreach (self::$formatConvertRules as $key => $value) { if (substr($format, $i, \strlen($key)) === $key) { @@ -93,8 +93,8 @@ public function convert(string $format): string break; } } - //if no rule is matched, then just add the character to the - //output + // if no rule is matched, then just add the character to the + // output if (!$foundOne) { $output .= $format[$i]; } diff --git a/src/Type/BasePickerType.php b/src/Type/BasePickerType.php index 29a40ef5..d7422ac6 100644 --- a/src/Type/BasePickerType.php +++ b/src/Type/BasePickerType.php @@ -92,8 +92,8 @@ public function configureOptions(OptionsResolver $resolver): void if (\is_int($format)) { $timeFormat = \IntlDateFormatter::NONE; - if ($options['dp_pick_time']) { - $timeFormat = $options['dp_use_seconds'] ? + if (true === $options['dp_pick_time']) { + $timeFormat = true === $options['dp_use_seconds'] ? DateTimeType::DEFAULT_TIME_FORMAT : \IntlDateFormatter::SHORT; } diff --git a/src/Validator/ErrorElement.php b/src/Validator/ErrorElement.php index 8b813e42..afafad7f 100755 --- a/src/Validator/ErrorElement.php +++ b/src/Validator/ErrorElement.php @@ -303,7 +303,7 @@ private function newConstraint(string $name, array $options = []) private function getCurrentPropertyPath(): ?PropertyPathInterface { if (!isset($this->propertyPaths[$this->current])) { - return null; //global error + return null; // global error } return $this->propertyPaths[$this->current]; diff --git a/tests/Date/MomentFormatConverterTest.php b/tests/Date/MomentFormatConverterTest.php index d1280461..5e10c110 100644 --- a/tests/Date/MomentFormatConverterTest.php +++ b/tests/Date/MomentFormatConverterTest.php @@ -84,7 +84,7 @@ public function testPhpToMoment(): void $phpFormat = 'D MMM y'; static::assertSame('D MMM YYYY', $mfc->convert($phpFormat)); - $phpFormat = "dd 'de' MMMM 'de' YYYY"; //Brazilian date format + $phpFormat = "dd 'de' MMMM 'de' YYYY"; // Brazilian date format static::assertSame('DD [de] MMMM [de] YYYY', $mfc->convert($phpFormat)); } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 6dd23778..c9a01342 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -11,14 +11,14 @@ * file that was distributed with this source code. */ -use Doctrine\Deprecations\Deprecation; - /* * DO NOT EDIT THIS FILE! * * It's auto-generated by sonata-project/dev-kit package. */ +use Doctrine\Deprecations\Deprecation; + /* * fix encoding issue while running text on different host with different locale configuration */