Skip to content

Commit

Permalink
Bump supported Symfony versions
Browse files Browse the repository at this point in the history
Adjust Symfony bundle code to work with newer versions
  • Loading branch information
stloyd committed Dec 18, 2023
1 parent 698cfba commit 4e2a656
Show file tree
Hide file tree
Showing 29 changed files with 480 additions and 388 deletions.
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"azuyalabs/yasumi": "~2.0",
"doctrine/dbal": "~2.6 || ~3.0",
"psr/cache": "~1.0|~2.0|~3.0",
"symfony/config": "~4.4.44||~5.4.21||~6.0",
"symfony/dependency-injection": "~4.4.49||~5.4.21||~6.0",
"symfony/form": "~4.4.48||~5.4.21||~6.0",
"symfony/http-kernel": "~4.4.50||~5.4.21||~6.0",
"symfony/config": "~5.4.21||~6.3||~7.0",
"symfony/dependency-injection": "~5.4.21||~6.3||~7.0",
"symfony/form": "~5.4.21||~6.3||~7.0",
"symfony/http-kernel": "~5.4.21||~6.3||~7.0",
"symfony/polyfill-mbstring": "~1.0",
"symfony/validator": "~4.4.48||~5.4.21||~6.0",
"symfony/validator": "~5.4.21||~6.3||~7.0",
"twig/twig": "~1.43||~2.10||~3"
},
"require-dev": {
Expand All @@ -32,11 +32,11 @@
"flow-php/etl-adapter-http": "^0.1 || ^0.2",
"google/apiclient": "^2.0",
"phpbench/phpbench": "^1.2.6",
"symfony/browser-kit": "~4.4.44||~5.4.21||~6",
"symfony/cache": "~4.4.48||~5.1||~6.0",
"symfony/dom-crawler": "~4.4.45||~5.4.21||~6.0",
"symfony/framework-bundle": "~4.4.49||~5.4.21||~6.0",
"symfony/security-bundle": "~4.4.44||~5.4.21||~6.0"
"symfony/browser-kit": "~5.4.21||~6.3||~7.0",
"symfony/cache": "~5.4||~6.3||~7.0",
"symfony/dom-crawler": "~5.4.21||~6.3||~7.0",
"symfony/framework-bundle": "~5.4.21||~6.3||~7.0",
"symfony/security-bundle": "~5.4.21||~6.3||~7.0"
},
"suggest": {
"ext-bcmath": "Compare time units with high precision"
Expand Down
603 changes: 306 additions & 297 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/rate-limiter/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"symfony/polyfill-mbstring": "~1.0"
},
"require-dev": {
"symfony/cache": "~4.4.48||~5.1||~6.0"
"symfony/cache": "~5.4||~6.3||~7.0"
},
"config": {
"optimize-autoloader": true,
Expand Down
18 changes: 9 additions & 9 deletions src/symfony-bundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
"aeon-php/rate-limiter": "~1.0",
"aeon-php/retry": "~1.0",
"aeon-php/sleep": "~1.0",
"symfony/config": "~4.4.44||~5.4.21||~6.0",
"symfony/dependency-injection": "~4.4.49||~5.4.21||~6.0",
"symfony/form": "~4.4.48||~5.4.21||~6.0",
"symfony/http-kernel": "~4.4.50||~5.4.21||~6.0",
"symfony/validator": "~4.4.48||~5.4.21||~6.0"
"symfony/config": "~5.4.21||~6.3||~7.0",
"symfony/dependency-injection": "~5.4.21||~6.3||~7.0",
"symfony/form": "~5.4.21||~6.3||~7.0",
"symfony/http-kernel": "~5.4.21||~6.3||~7.0",
"symfony/validator": "~5.4.21||~6.3||~7.0"
},
"require-dev": {
"aeon-php/calendar-holidays-yasumi": "~1.0",
"symfony/browser-kit": "~4.4.44||~5.4.21||~6",
"symfony/dom-crawler": "~4.4.45||~5.4.21||~6.0",
"symfony/framework-bundle": "~4.4.49||~5.4.21||~6.0",
"symfony/security-bundle": "~4.4.44||~5.4.21||~6.0"
"symfony/browser-kit": "~5.4.21||~6.3||~7.0",
"symfony/dom-crawler": "~5.4.21||~6.3||~7.0",
"symfony/framework-bundle": "~5.4.21||~6.3||~7.0",
"symfony/security-bundle": "~5.4.21||~6.3||~7.0"
},
"license": "MIT",
"autoload": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Aeon\RateLimiter\Algorithm\LeakyBucketAlgorithm;
use Aeon\RateLimiter\Algorithm\SlidingWindowAlgorithm;
use Aeon\RateLimiter\RateLimiter;
use Aeon\Symfony\AeonBundle\DependencyInjection\Loader\Configurator\LegacyConfigurator;
use Aeon\Symfony\AeonBundle\EventListener\RateLimitExceptionListener;
use Aeon\Symfony\AeonBundle\RateLimiter\RateLimitHttpProtocol;
use Aeon\Symfony\AeonBundle\RateLimiter\RequestIdentificationStrategy\HeaderRequestIdentificationStrategy;
Expand All @@ -29,9 +28,6 @@ final class AeonExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container) : void
{
// Trigger autoloading of legacy service function
\class_exists(LegacyConfigurator::class);

$config = $this->processConfiguration($this->getConfiguration($configs, $container), $configs);

$loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

final class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
public function getConfigTreeBuilder() : TreeBuilder
{
$treeBuilder = new TreeBuilder('aeon');
/**
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class AeonDateTimeToDateTimeTransformer implements DataTransformerInterfac
/**
* @psalm-suppress MissingReturnType
*/
public function transform($value)
public function transform($value) : mixed
{
if ($value instanceof DateTime) {
return $value->toDateTimeImmutable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class AeonDayToDateTimeTransformer implements DataTransformerInterface
/**
* @psalm-suppress MissingReturnType
*/
public function transform($value)
public function transform($value) : mixed
{
if ($value instanceof Day) {
return $value->toDateTimeImmutable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class AeonTimeToDateTimeTransformer implements DataTransformerInterface
/**
* @psalm-suppress MissingReturnType
*/
public function transform($value)
public function transform($value) : mixed
{
if ($value instanceof Time) {
return new \DateTimeImmutable($value->toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class AeonTimeZoneToDateTimeTransformer implements DataTransformerInterfac
/**
* @psalm-suppress MissingReturnType
*/
public function transform($value)
public function transform($value) : mixed
{
if ($value instanceof TimeZone) {
return $value->toDateTimeZone();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

use function Aeon\Symfony\AeonBundle\DependencyInjection\Loader\Configurator\service;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
use Aeon\Calendar\Gregorian\Calendar;
use Aeon\Calendar\Gregorian\GregorianCalendar;
use Aeon\Calendar\Gregorian\TimeZone;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

use function Aeon\Symfony\AeonBundle\DependencyInjection\Loader\Configurator\service;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
use Aeon\Symfony\AeonBundle\Validator\Constraints\HolidayValidator;
use Aeon\Symfony\AeonBundle\Validator\Constraints\NotHolidayValidator;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

use function Aeon\Symfony\AeonBundle\DependencyInjection\Loader\Configurator\service;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
use Aeon\Symfony\AeonBundle\RateLimiter\RateLimiters;
use Aeon\Symfony\AeonBundle\Twig\RateLimiterExtension;
use Aeon\Twig\CalendarExtension;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

use function Aeon\Symfony\AeonBundle\DependencyInjection\Loader\Configurator\service;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
use Aeon\Symfony\AeonBundle\EventListener\RateLimitRequestListener;
use Aeon\Symfony\AeonBundle\EventListener\RateLimitResponseListener;
use Aeon\Symfony\AeonBundle\RateLimiter\RateLimiters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,29 @@ final class After extends AbstractComparison
{
public const BEFORE_OR_EQUAL_ERROR = '99f63b74-a275-4a01-8678-63124971bff8';

/**
* @var array<string, string>
*/
protected const ERROR_NAMES = [
self::BEFORE_OR_EQUAL_ERROR => 'BEFORE_OR_EQUAL_ERROR',
];

/**
* @var array<string, string>
*/
protected static $errorNames = [
self::BEFORE_OR_EQUAL_ERROR => 'BEFORE_OR_EQUAL_ERROR',
];

public $message = 'This value should be after {{ compared_value }}.';
public function __construct(mixed $value = null, string $propertyPath = null, string $message = 'This value should be after {{ compared_value }}.', array $groups = null, mixed $payload = null, array $options = [])
{
parent::__construct(
$value,
$propertyPath,
$message,
$groups,
$payload,
$options
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,29 @@ final class AfterOrEqual extends AbstractComparison
{
public const BEFORE_ERROR = '1c6d2666-52d7-4131-bd11-3f90e2120c2d';

/**
* @var array<string, string>
*/
protected const ERROR_NAMES = [
self::BEFORE_ERROR => 'BEFORE_ERROR',
];

/**
* @var array<string, string>
*/
protected static $errorNames = [
self::BEFORE_ERROR => 'BEFORE_ERROR',
];

public $message = 'This value should be after or equal {{ compared_value }}.';
public function __construct(mixed $value = null, string $propertyPath = null, string $message = 'This value should be after or equal {{ compared_value }}.', array $groups = null, mixed $payload = null, array $options = [])
{
parent::__construct(
$value,
$propertyPath,
$message,
$groups,
$payload,
$options
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class AfterOrEqualValidator extends AbstractComparisonValidator
{
/**
* @param DateTime|Day|Month|Year $value1
* @param ?DateTime|?Day|?Month|?Year $value2
* @param null|DateTime|Day|Month|Year $value2
*
* @return bool
*/
Expand All @@ -28,7 +28,7 @@ protected function compareValues($value1, $value2) : bool
return false;
}

return $value1->isAfterOrEqual($value2);
return $value1->isAfterOrEqualTo($value2);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class AfterValidator extends AbstractComparisonValidator
{
/**
* @param DateTime|Day|Month|Year $value1
* @param ?DateTime|?Day|?Month|?Year $value2
* @param null|DateTime|Day|Month|Year $value2
*
* @return bool
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,29 @@ final class Before extends AbstractComparison
{
public const BEFORE_OR_EQUAL_ERROR = 'c561f511-0fee-4fed-8505-6e67e21aa903';

/**
* @var array<string, string>
*/
protected const ERROR_NAMES = [
self::BEFORE_OR_EQUAL_ERROR => 'BEFORE_OR_EQUAL_ERROR',
];

/**
* @var array<string, string>
*/
protected static $errorNames = [
self::BEFORE_OR_EQUAL_ERROR => 'BEFORE_OR_EQUAL_ERROR',
];

public $message = 'This value should be before {{ compared_value }}.';
public function __construct(mixed $value = null, string $propertyPath = null, string $message = 'This value should be before {{ compared_value }}.', array $groups = null, mixed $payload = null, array $options = [])
{
parent::__construct(
$value,
$propertyPath,
$message,
$groups,
$payload,
$options
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,29 @@ final class BeforeOrEqual extends AbstractComparison
{
public const AFTER_ERROR = 'c411b575-c9fd-4e22-af8a-2e23a565d9a4';

/**
* @var array<string, string>
*/
protected const ERROR_NAMES = [
self::AFTER_ERROR => 'AFTER_ERROR',
];

/**
* @var array<string, string>
*/
protected static $errorNames = [
self::AFTER_ERROR => 'AFTER_ERROR',
];

public $message = 'This value should be before or equal {{ compared_value }}.';
public function __construct(mixed $value = null, string $propertyPath = null, string $message = 'This value should be before or equal {{ compared_value }}.', array $groups = null, mixed $payload = null, array $options = [])
{
parent::__construct(
$value,
$propertyPath,
$message,
$groups,
$payload,
$options
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class BeforeOrEqualValidator extends AbstractComparisonValidator
{
/**
* @param DateTime|Day|Month|Year $value1
* @param ?DateTime|?Day|?Month|?Year $value2
* @param null|DateTime|Day|Month|Year $value2
*
* @return bool
*/
Expand All @@ -28,7 +28,7 @@ protected function compareValues($value1, $value2) : bool
return false;
}

return $value1->isBeforeOrEqual($value2);
return $value1->isBeforeOrEqualTo($value2);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class BeforeValidator extends AbstractComparisonValidator
{
/**
* @param DateTime|Day|Month|Year $value1
* @param ?DateTime|?Day|?Month|?Year $value2
* @param null|DateTime|Day|Month|Year $value2
*
* @return bool
*/
Expand Down
Loading

0 comments on commit 4e2a656

Please sign in to comment.