Skip to content

Commit

Permalink
DevKit updates for 1.x branch (#315)
Browse files Browse the repository at this point in the history
* DevKit updates

* DevKit updates

* Fix build

Co-authored-by: Vincent Langlet <vincentlanglet@hotmail.fr>
  • Loading branch information
SonataCI and VincentLanglet committed Mar 28, 2022
1 parent 336439d commit 61af8d3
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 17 deletions.
11 changes: 11 additions & 0 deletions .php-cs-fixer.dist.php
@@ -1,5 +1,16 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

/*
* DO NOT EDIT THIS FILE!
*
Expand Down
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Expand Up @@ -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
22 changes: 11 additions & 11 deletions src/Date/MomentFormatConverter.php
Expand Up @@ -61,28 +61,28 @@ 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;
$output .= ']';
$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) {
Expand All @@ -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];
}
Expand Down
4 changes: 2 additions & 2 deletions src/Type/BasePickerType.php
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Validator/ErrorElement.php
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion tests/Date/MomentFormatConverterTest.php
Expand Up @@ -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));
}
}
4 changes: 2 additions & 2 deletions tests/bootstrap.php
Expand Up @@ -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
*/
Expand Down

0 comments on commit 61af8d3

Please sign in to comment.