-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 5.4: Fix implicitly-required parameters List CS fix in .git-blame-ignore-revs Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value [Messenger][AmazonSqs] Allow async-aws/sqs version 2
- Loading branch information
Showing
23 changed files
with
3,306 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Intl\DateFormatter\DateFormat; | ||
|
||
/** | ||
* Parser and formatter for 12 hour format (0-11). | ||
* | ||
* @author Igor Wiedler <igor@wiedler.ch> | ||
* | ||
* @internal | ||
* | ||
* @deprecated since Symfony 5.3, use symfony/polyfill-intl-icu ^1.21 instead | ||
*/ | ||
class Hour1200Transformer extends HourTransformer | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function format(\DateTime $dateTime, int $length): string | ||
{ | ||
$hourOfDay = $dateTime->format('g'); | ||
$hourOfDay = '12' === $hourOfDay ? '0' : $hourOfDay; | ||
|
||
return $this->padLeft($hourOfDay, $length); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function normalizeHour(int $hour, ?string $marker = null): int | ||
{ | ||
if ('PM' === $marker) { | ||
$hour += 12; | ||
} | ||
|
||
return $hour; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getReverseMatchingRegExp(int $length): string | ||
{ | ||
return '\d{1,2}'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function extractDateOptions(string $matched, int $length): array | ||
{ | ||
return [ | ||
'hour' => (int) $matched, | ||
'hourInstance' => $this, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Intl\DateFormatter\DateFormat; | ||
|
||
/** | ||
* Parser and formatter for 12 hour format (1-12). | ||
* | ||
* @author Igor Wiedler <igor@wiedler.ch> | ||
* | ||
* @internal | ||
* | ||
* @deprecated since Symfony 5.3, use symfony/polyfill-intl-icu ^1.21 instead | ||
*/ | ||
class Hour1201Transformer extends HourTransformer | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function format(\DateTime $dateTime, int $length): string | ||
{ | ||
return $this->padLeft($dateTime->format('g'), $length); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function normalizeHour(int $hour, ?string $marker = null): int | ||
{ | ||
if ('PM' !== $marker && 12 === $hour) { | ||
$hour = 0; | ||
} elseif ('PM' === $marker && 12 !== $hour) { | ||
// If PM and hour is not 12 (1-12), sum 12 hour | ||
$hour += 12; | ||
} | ||
|
||
return $hour; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getReverseMatchingRegExp(int $length): string | ||
{ | ||
return '\d{1,2}'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function extractDateOptions(string $matched, int $length): array | ||
{ | ||
return [ | ||
'hour' => (int) $matched, | ||
'hourInstance' => $this, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Intl\DateFormatter\DateFormat; | ||
|
||
/** | ||
* Parser and formatter for 24 hour format (0-23). | ||
* | ||
* @author Igor Wiedler <igor@wiedler.ch> | ||
* | ||
* @internal | ||
* | ||
* @deprecated since Symfony 5.3, use symfony/polyfill-intl-icu ^1.21 instead | ||
*/ | ||
class Hour2400Transformer extends HourTransformer | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function format(\DateTime $dateTime, int $length): string | ||
{ | ||
return $this->padLeft($dateTime->format('G'), $length); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function normalizeHour(int $hour, ?string $marker = null): int | ||
{ | ||
if ('AM' === $marker) { | ||
$hour = 0; | ||
} elseif ('PM' === $marker) { | ||
$hour = 12; | ||
} | ||
|
||
return $hour; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getReverseMatchingRegExp(int $length): string | ||
{ | ||
return '\d{1,2}'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function extractDateOptions(string $matched, int $length): array | ||
{ | ||
return [ | ||
'hour' => (int) $matched, | ||
'hourInstance' => $this, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Intl\DateFormatter\DateFormat; | ||
|
||
/** | ||
* Parser and formatter for 24 hour format (1-24). | ||
* | ||
* @author Igor Wiedler <igor@wiedler.ch> | ||
* | ||
* @internal | ||
* | ||
* @deprecated since Symfony 5.3, use symfony/polyfill-intl-icu ^1.21 instead | ||
*/ | ||
class Hour2401Transformer extends HourTransformer | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function format(\DateTime $dateTime, int $length): string | ||
{ | ||
$hourOfDay = $dateTime->format('G'); | ||
$hourOfDay = '0' === $hourOfDay ? '24' : $hourOfDay; | ||
|
||
return $this->padLeft($hourOfDay, $length); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function normalizeHour(int $hour, ?string $marker = null): int | ||
{ | ||
if ((null === $marker && 24 === $hour) || 'AM' === $marker) { | ||
$hour = 0; | ||
} elseif ('PM' === $marker) { | ||
$hour = 12; | ||
} | ||
|
||
return $hour; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getReverseMatchingRegExp(int $length): string | ||
{ | ||
return '\d{1,2}'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function extractDateOptions(string $matched, int $length): array | ||
{ | ||
return [ | ||
'hour' => (int) $matched, | ||
'hourInstance' => $this, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Intl\DateFormatter\DateFormat; | ||
|
||
/** | ||
* Base class for hour transformers. | ||
* | ||
* @author Eriksen Costa <eriksen.costa@infranology.com.br> | ||
* | ||
* @internal | ||
* | ||
* @deprecated since Symfony 5.3, use symfony/polyfill-intl-icu ^1.21 instead | ||
*/ | ||
abstract class HourTransformer extends Transformer | ||
{ | ||
/** | ||
* Returns a normalized hour value suitable for the hour transformer type. | ||
* | ||
* @param int $hour The hour value | ||
* @param string|null $marker An optional AM/PM marker | ||
* | ||
* @return int The normalized hour value | ||
*/ | ||
abstract public function normalizeHour(int $hour, ?string $marker = null): int; | ||
} |
Oops, something went wrong.