8000 Remove deadcode after the bump to PHP >= 8.4 · symfony/symfony@b76b449 · GitHub
[go: up one dir, main page]

Skip to content

Commit b76b449

Browse files
Remove deadcode after the bump to PHP >= 8.4
1 parent 6251fbc commit b76b449

File tree

87 files changed

+124
-2567
lines changed
  • ErrorHandler
  • HttpClient
  • HttpKernel
  • JsonStreamer
  • Ldap/Security
  • PasswordHasher/Tests/Hasher
  • Process/Tests
  • PropertyAccess/Tests
  • PropertyInfo
  • Security/Core
  • Serializer/Tests/Normalizer
  • String
  • Validator/Constraints
  • VarDumper
  • VarExporter
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    87 files changed

    +124
    -2567
    lines changed

    src/Symfony/Bridge/Doctrine/ManagerRegistry.php

    Lines changed: 0 additions & 30 deletions
    Original file line numberDiff line numberDiff line change
    @@ -12,8 +12,6 @@
    1212
    namespace Symfony\Bridge\Doctrine;
    1313

    1414
    use Doctrine\Persistence\AbstractManagerRegistry;
    15-
    use ProxyManager\Proxy\GhostObjectInterface;
    16-
    use ProxyManager\Proxy\LazyLoadingInterface;
    1715
    use Symfony\Component\DependencyInjection\Container;
    1816
    use Symfony\Component\VarExporter\LazyObjectInterface;
    1917

    @@ -45,34 +43,6 @@ protected function resetService($name): void
    4543

    4644
    return;
    4745
    }
    48-
    if (\PHP_VERSION_ID < 80400) {
    49-
    if (!$manager instanceof LazyLoadingInterface) {
    50-
    throw new \LogicException(\sprintf('Resetting a non-lazy manager service is not supported. Declare the "%s" service as lazy.', $name));
    51-
    }
    52-
    trigger_deprecation('symfony/doctrine-bridge', '7.3', 'Support for proxy-manager is deprecated.');
    53-
    54-
    if ($manager instanceof GhostObjectInterface) {
    55-
    throw new \LogicException('Resetting a lazy-ghost-object manager service is not supported.');
    56-
    }
    57-
    $manager->setProxyInitializer(\Closure::bind(
    58-
    function (&$wrappedInstance, LazyLoadingInterface $manager) use ($name) {
    59-
    $name = $this->aliases[$name] ?? $name;
    60-
    $wrappedInstance = match (true) {
    61-
    isset($this->fileMap[$name]) => $this->load($this->fileMap[$name], false),
    62-
    !$method = $this->methodMap[$name] ?? null => throw new \LogicException(\sprintf('The "%s" service is synthetic and cannot be reset.', $name)),
    63-
    (new \ReflectionMethod($this, $method))->isStatic() => $this->{$method}($this, false),
    64-
    default => $this->{$method}(false),
    65-
    };
    66-
    $manager->setProxyInitializer(null);
    67-
    68-
    return true;
    69-
    },
    70-
    $this->container,
    71-
    Container::class
    72-
    ));
    73-
    74-
    return;
    75 10000 -
    }
    7646

    7747
    $r = new \ReflectionClass($manager);
    7848

    src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -100,7 +100,7 @@ public function refreshUser(UserInterface $user): UserInterface
    100100

    101101
    if ($refreshedUser instanceof Proxy && !$refreshedUser->__isInitialized()) {
    102102
    $refreshedUser->__load();
    103-
    } elseif (\PHP_VERSION_ID >= 80400 && ($r = new \ReflectionClass($refreshedUser))->isUninitializedLazyObject($refreshedUser)) {
    103+
    } elseif (($r = new \ReflectionClass($refreshedUser))->isUninitializedLazyObject($refreshedUser)) {
    104104
    $r->initializeLazyObject($refreshedUser);
    105105
    }
    106106

    src/Symfony/Bridge/Doctrine/Tests/DoctrineTestHelper.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -47,7 +47,7 @@ public static function createTestEntityManager(?Configuration $config = null): E
    4747
    $config ??= self::createTestConfiguration();
    4848
    $eventManager = new EventManager();
    4949

    50-
    if (\PHP_VERSION_ID >= 80400 && method_exists($config, 'enableNativeLazyObjects')) {
    50+
    if (method_exists($config, 'enableNativeLazyObjects')) {
    5151
    $config->enableNativeLazyObjects(true);
    5252
    }
    5353

    src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php

    Lines changed: 0 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -50,8 +50,6 @@ public function testResetService()
    5050
    }
    5151

    5252
    /**
    53-
    * @requires PHP 8.4
    54-
    *
    5553
    * @dataProvider provideResetServiceWithNativeLazyObjectsCases
    5654
    */
    5755
    public function testResetServiceWithNativeLazyObjects(string $class)

    src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -220,7 +220,7 @@ public function testRefreshedUserProxyIsLoaded()
    220220
    $provider = new EntityUserProvider($this->getManager($em), User::class);
    221221
    $refreshedUser = $provider->refreshUser($user);
    222222

    223-
    if (\PHP_VERSION_ID >= 80400 && method_exists(Configuration::class, 'enableNativeLazyObjects')) {
    223+
    if (method_exists(Configuration::class, 'enableNativeLazyObjects')) {
    224224
    $this->assertFalse((new \ReflectionClass(User::class))->isUninitializedLazyObject($refreshedUser));
    225225
    $this->assertSame('user1', $refreshedUser->name);
    226226
    } else {

    src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/php_deprecation_from_vendor_class.phpt

    Lines changed: 0 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,7 +1,5 @@
    11
    --TEST--
    22
    Test that a PHP deprecation from a vendor class autoload is considered indirect.
    3-
    --SKIPIF--
    4-
    <?php if (\PHP_VERSION_ID < 80100) echo 'skip'; ?>
    53
    --FILE--
    64
    <?php
    75

    src/Symfony/Bridge/PhpUnit/Tests/EnumExistsMockTest.php

    Lines changed: 0 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -16,9 +16,6 @@
    1616
    use Symfony\Bridge\PhpUnit\Tests\Fixtures\ExistingEnum;
    1717
    use Symfony\Bridge\PhpUnit\Tests\Fixtures\ExistingEnumReal;
    1818

    19-
    /**
    20-
    * @requires PHP 8.1
    21-
    */
    2219
    class EnumExistsMockTest extends TestCase
    2320
    {
    2421
    public static function setUpBeforeClass(): void

    src/Symfony/Bridge/PhpUnit/Tests/Metadata/AttributeReaderTest.php

    Lines changed: 1 addition & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -17,10 +17,7 @@
    1717
    use Symfony\Bridge\PhpUnit\Metadata\AttributeReader;
    1818
    use Symfony\Bridge\PhpUnit\Tests\Metadata\Fixtures\FooBar;
    1919

    20-
    /**
    21-
    * @requires PHP 8.0
    22-
    */
    23-
    final class AttributeReaderTest extends TestCase
    20+
    class AttributeReaderTest extends TestCase
    2421
    {
    2522
    /**
    2623
    * @dataProvider provideReadCases

    src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php

    Lines changed: 4 additions & 21 deletions
    Original file line numberDiff line numberDiff line change
    @@ -97,11 +97,7 @@
    9797
    }
    9898
    };
    9999

    100-
    if (\PHP_VERSION_ID >= 80000) {
    101-
    $PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '9.6') ?: '9.6';
    102-
    } else {
    103-
    $PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '8.5') ?: '8.5';
    104-
    }
    100+
    $PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '9.6') ?: '9.6';
    105101

    106102
    $MAX_PHPUNIT_VERSION = $getEnvVar('SYMFONY_MAX_PHPUNIT_VERSION', false);
    107103

    @@ -177,7 +173,7 @@
    177173
    $prevCacheDir = false;
    178174
    }
    179175
    }
    180-
    $SYMFONY_PHPUNIT_REMOVE = $getEnvVar('SYMFONY_PHPUNIT_REMOVE', 'phpspec/prophecy'.($PHPUNIT_VERSION < 6.0 ? ' symfony/yaml' : ''));
    176+
    $SYMFONY_PHPUNIT_REMOVE = $getEnvVar('SYMFONY_PHPUNIT_REMOVE', 'phpspec/prophecy');
    181177
    $SYMFONY_PHPUNIT_REQUIRE = $getEnvVar('SYMFONY_PHPUNIT_REQUIRE', '');
    182178
    $configurationHash = md5(implode(\PHP_EOL, [md5_file(__FILE__), $SYMFONY_PHPUNIT_REMOVE, $SYMFONY_PHPUNIT_REQUIRE, (int) $PHPUNIT_REMOVE_RETURN_TYPEHINT]));
    183179
    $PHPUNIT_VERSION_DIR = sprintf('phpunit-%s-%d', $PHPUNIT_VERSION, $PHPUNIT_REMOVE_RETURN_TYPEHINT);
    @@ -239,9 +235,6 @@
    239235
    if ($SYMFONY_PHPUNIT_REQUIRE) {
    240236
    $passthruOrFail("$COMPOSER require --no-update --no-interaction ".$SYMFONY_PHPUNIT_REQUIRE);
    241237
    }
    242-
    if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) {
    243-
    $passthruOrFail("$COMPOSER require --no-update --no-interaction phpunit/phpunit-mock-objects \"~3.1.0\"");
    244-
    }
    245238

    246239
    if (preg_match('{\^((\d++\.)\d++)[\d\.]*$}', $info['requires']['php'], $phpVersion) && version_compare($phpVersion[2].'99', \PHP_VERSION, '<')) {
    247240
    $passthruOrFail("$COMPOSER config platform.php \"$phpVersion[1].99\"");
    @@ -266,9 +259,8 @@
    266259
    }
    267260
    $prevRoot = getenv('COMPOSER_ROOT_VERSION');
    268261
    putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");
    269-
    $q = '\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 80000 ? '"' : '';
    270262
    // --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS
    271-
    $exit = proc_close(proc_open("$q$COMPOSER update --no-dev --prefer-dist --no-progress $q", [], $p, getcwd()));
    263+
    $exit = proc_close(proc_open("$COMPOSER update --no-dev --prefer-dist --no-progress", [], $p, getcwd()));
    272264
    putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : ''));
    273265
    if ($prevCacheDir) {
    274266
    putenv("COMPOSER_CACHE_DIR=$prevCacheDir");
    @@ -339,16 +331,7 @@ class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\Bla
    339331
    }
    340332
    chdir($oldPwd);
    341333

    342-
    if ($PHPUNIT_VERSION < 8.0) {
    343-
    $argv = array_filter($argv, function ($v) use (&$argc) {
    344-
    if ('--do-not-cache-result' !== $v) {
    345-
    return true;
    346-
    }
    347-
    --$argc;
    348-
    349-
    return false;
    350-
    });
    351-
    } elseif (filter_var(getenv('SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE'), \FILTER_VALIDATE_BOOLEAN)) {
    334+
    if (filter_var(getenv('SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE'), \FILTER_VALIDATE_BOOLEAN)) {
    352335
    $argv[] = '--do-not-cache-result';
    353336
    ++$argc;
    354337
    }

    src/Symfony/Bridge/PhpUnit/bootstrap.php

    Lines changed: 0 additions & 14 deletions
    Original file line numberDiff line numberDiff line change
    @@ -9,7 +9,6 @@
    99
    * file that was distributed with this source code.
    1010
    */
    1111

    12-
    use Doctrine\Common\Annotations\AnnotationRegistry;
    1312
    use Doctrine\Deprecations\Deprecation;
    1413
    use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
    1514

    @@ -31,19 +30,6 @@
    3130

    3231
    if (class_exists(Deprecation::class)) {
    3332
    Deprecation::withoutDeduplication();
    34-
    35-
    if (\PHP_VERSION_ID < 80000) {
    36-
    // Ignore deprecations about the annotation mapping driver when it's not possible to move to the attribute driver yet
    37-
    Deprecation::ignoreDeprecations('https://github.com/doctrine/orm/issues/10098');
    38-
    }
    39-
    }
    40-
    41-
    if (!class_exists(AnnotationRegistry::class, false) && class_exists(AnnotationRegistry::class)) {
    42-
    if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
    43-
    AnnotationRegistry::registerUniqueLoader('class_exists');
    44-
    } elseif (method_exists(AnnotationRegistry::class, 'registerLoader')) {
    45-
    AnnotationRegistry::registerLoader('class_exists');
    46-
    }
    4733
    }
    4834

    4935
    if ('disabled' !== getenv('SYMFONY_DEPRECATIONS_HELPER')) {

    src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

    Lines changed: 0 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -2132,10 +2132,6 @@ private function registerJsonStreamerConfiguration(array $config, ContainerBuild
    21322132
    $container->setParameter('.json_streamer.stream_writers_dir', '%kernel.cache_dir%/json_streamer/stream_writer');
    21332133
    $container->setParameter('.json_streamer.stream_readers_dir', '%kernel.cache_dir%/json_streamer/stream_reader');
    21342134
    $container->setParameter('.json_streamer.lazy_ghosts_dir', '%kernel.cache_dir%/json_streamer/lazy_ghost');
    2135-
    2136-
    if (\PHP_VERSION_ID >= 80400) {
    2137-
    $container->removeDefinition('.json_streamer.cache_warmer.lazy_ghost');
    2138-
    }
    21392135
    }
    21402136

    21412137
    private function registerPropertyInfoConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader): void

    src/Symfony/Bundle/FrameworkBundle/Resources/config/json_streamer.php

    Lines changed: 0 additions & 7 deletions
    Original file line numberDiff line numberDiff line change
    @@ -108,12 +108,5 @@
    108108
    service('logger')->ignoreOnInvalid(),
    109109
    ])
    110110
    ->tag('kernel.cache_warmer')
    111-
    112-
    ->set('.json_streamer.cache_warmer.lazy_ghost', LazyGhostCacheWarmer::class)
    113-
    ->args([
    114-
    abstract_arg('streamable class names'),
    115-
    param('.json_streamer.lazy_ghosts_dir'),
    116-
    ])
    117-
    ->tag('kernel.cache_warmer')
    118111
    ;
    119112
    };

    src/Symfony/Bundle/WebProfilerBundle/Profiler/CodeExtension.php

    Lines changed: 7 additions & 15 deletions
    Original file line numberDiff line numberDiff line change
    @@ -123,21 +123,13 @@ public function fileExcerpt(string $file, int $line, int $srcContext = 3): ?stri
    123123
    // highlight_file could throw warnings
    124124
    // see https://bugs.php.net/25725
    125125
    $code = @highlight_file($file, true);
    126-
    if (\PHP_VERSION_ID >= 80300) {
    127-
    // remove main pre/code tags
    128-
    $code = preg_replace('#^<pre.*?>\s*<code.*?>(.*)</code>\s*</pre>#s', '\\1', $code);
    129-
    // split multiline span tags
    130-
    $code = preg_replace_callback('#<span ([^>]++)>((?:[^<\\n]*+\\n)++[^<]*+)</span>#', function ($m) {
    131-
    return "<span $m[1]>".str_replace("\n", "</span>\n<span $m[1]>", $m[2]).'</span>';
    132-
    }, $code);
    133-
    $content = explode("\n", $code);
    134-
    } else {
    135-
    // remove main code/span tags
    136-
    $code = preg_replace('#^<code.*?>\s*<span.*?>(.*)</span>\s*</code>#s', '\\1', $code);
    137-
    // split multiline spans
    138-
    $code = preg_replace_callback('#<span ([^>]++)>((?:[^<]*+<br \/>)++[^<]*+)</span>#', fn ($m) => "<span $m[1]>".str_replace('<br />', "</span><br /><span $m[1]>", $m[2]).'</span>', $code);
    139-
    $content = explode('<br />', $code);
    140-
    }
    126+
    // remove main pre/code tags
    127+
    $code = preg_replace('#^<pre.*?>\s*<code.*?>(.*)</code>\s*</pre>#s', '\\1', $code);
    128+
    // split multiline span tags
    129+
    $code = preg_replace_callback('#<span ([^>]++)>((?:[^<\\n]*+\\n)++[^<]*+)</span>#', function ($m) {
    130+
    return "<span $m[1]>".str_replace("\n", "</span>\n<span $m[1]>", $m[2]).'</span>';
    131+
    }, $code);
    132+
    $content = explode("\n", $code);
    141133

    142134
    $lines = [];
    143135
    if (0 > $srcContext) {

    src/Symfony/Component/Clock/Clock.php

    Lines changed: 1 addition & 7 deletions
    Original file line numberDiff line numberDiff line change
    @@ -71,14 +71,8 @@ public function sleep(float|int $seconds): void
    7171
    */
    7272
    public function withTimeZone(\DateTimeZone|string $timezone): static
    7373
    {
    74-
    if (\PHP_VERSION_ID >= 80300 && \is_string($timezone)) {
    74+
    if (\is_string($timezone)) {
    7575
    $timezone = new \DateTimeZone($timezone);
    76-
    } elseif (\is_string($timezone)) {
    77-
    try {
    78-
    $timezone = new \DateTimeZone($timezone);
    79-
    } catch (\Exception $e) {
    80-
    throw new \DateInvalidTimeZoneException($e->getMessage(), $e->getCode(), $e);
    81-
    }
    8276
    }
    8377

    8478
    $clone = clone $this;

    src/Symfony/Component/Clock/DatePoint.php

    Lines changed: 3 additions & 45 deletions
    Original file line numberDiff line numberDiff line change
    @@ -30,17 +30,8 @@ public function __construct(string $datetime = 'now', ?\DateTimeZone $timezone =
    3030
    $now = static::createFromInterface($now);
    3131
    }
    3232

    33-
    if (\PHP_VERSION_ID < 80300) {
    34-
    try {
    35-
    $builtInDate = new parent($datetime, $timezone ?? $now->getTimezone());
    36-
    $timezone = $builtInDate->getTimezone();
    37-
    } catch (\Exception $e) {
    38-
    throw new \DateMalformedStringException($e->getMessage(), $e->getCode(), $e);
    39-
    }
    40-
    } else {
    41-
    $builtInDate = new parent($datetime, $timezone ?? $now->getTimezone());
    42-
    $timezone = $builtInDate->getTimezone();
    43-
    }
    33+
    $builtInDate = new parent($datetime, $timezone ?? $now->getTimezone());
    34+
    $timezone = $builtInDate->getTimezone();
    4435

    4536
    $now = $now->setTimezone($timezone)->modify($datetime);
    4637

    @@ -74,23 +65,7 @@ public static function createFromMutable(\DateTime $object): static
    7465

    7566
    public static function createFromTimestamp(int|float $timestamp): static
    7667
    {
    77-
    if (\PHP_VERSION_ID >= 80400) {
    78-
    return parent::createFromTimestamp($timestamp);
    79-
    }
    80-
    81-
    if (\is_int($timestamp) || !$ms = (int) $timestamp - $timestamp) {
    82-
    return static::createFromFormat('U', (string) $timestamp);
    83-
    }
    84-
    85-
    if (!is_finite($timestamp) || \PHP_INT_MAX + 1.0 <= $timestamp || \PHP_INT_MIN > $timestamp) {
    86-
    throw new \DateRangeError(\sprintf('DateTimeImmutable::createFromTimestamp(): Argument #1 ($timestamp) must be a finite number between %s and %s.999999, %s given', \PHP_INT_MIN, \PHP_INT_MAX, $timestamp));
    87-
    }
    88-
    89-
    if ($timestamp < 0) {
    90-
    $timestamp = (int) $timestamp - 2.0 + $ms;
    91-
    }
    92-
    93-
    return static::createFromFormat('U.u', \sprintf('%.6F', $timestamp));
    68+
    return parent::createFromTimestamp($timestamp);
    9469
    }
    9570

    9671
    public function add(\DateInterval $interval): static
    @@ -108,10 +83,6 @@ public function sub(\DateInterval $interval): static
    10883
    */
    10984
    public function modify(string $modifier): static
    11085
    {
    111-
    if (\PHP_VERSION_ID < 80300) {
    112-
    return @parent::modify($modifier) ?: throw new \DateMalformedStringException(error_get_last()['message'] ?? \sprintf('Invalid modifier: "%s".', $modifier));
    113-
    }
    114-
    11586
    return parent::modify($modifier);
    11687
    }
    11788

    @@ -151,19 +122,6 @@ public function setMicrosecond(int $microsecond): static
    151122
    throw new \DateRangeError('DatePoint::setMicrosecond(): Argument #1 ($microsecond) must be between 0 and 999999, '.$microsecond.' given');
    152123
    }
    153124

    154-
    if (\PHP_VERSION_ID < 80400) {
    155-
    return $this->setTime(...explode('.', $this->format('H.i.s.'.$microsecond)));
    156-
    }
    157-
    158125
    return parent::setMicrosecond($microsecond);
    159126
    }
    160-
    161-
    public function getMicrosecond(): int
    162-
    {
    163-
    if (\PHP_VERSION_ID >= 80400) {
    164-
    return parent::getMicrosecond();
    165-
    }
    166-
    167-
    return $this->format('u');
    168-
    }
    169127
    }

    src/Symfony/Component/Clock/MockClock.php

    Lines changed: 2 additions & 14 deletions
    Original file line numberDiff line numberDiff line change
    @@ -28,14 +28,8 @@ final class MockClock implements ClockInterface
    2828
    */
    2929
    public function __construct(\DateTimeImmutable|string $now = 'now', \DateTimeZone|string|null $timezone = null)
    3030
    {
    31-
    if (\PHP_VERSION_ID >= 80300 && \is_string($timezone)) {
    31+
    if (\is_string($timezone)) {
    3232
    $timezone = new \DateTimeZone($timezone);
    33-
    } elseif (\is_string($timezone)) {
    34-
    try {
    35-
    $timezone = new \DateTimeZone($timezone);
    36-
    } catch (\Exception $e) {
    37-
    throw new \DateInvalidTimeZoneException($e->getMessage(), $e->getCode(), $e);
    38-
    }
    3933
    }
    4034

    4135
    if (\is_string($now)) {
    @@ -66,12 +60,6 @@ public function sleep(float|int $seconds): void
    6660
    */
    6761
    public function modify(string $modifier): void
    6862
    {
    69-
    if (\PHP_VERSION_ID < 80300) {
    70-
    $this->now = @$this->now->modify($modifier) ?: throw new \DateMalformedStringException(error_get_last()['message'] ?? \sprintf('Invalid modifier: "%s". Could not modify MockClock.', $modifier));
    71-
    72-
    return;
    73-
    }
    74-
    7563
    $this->now = $this->now->modify($modifier);
    7664
    }
    7765

    @@ -80,7 +68,7 @@ public function modify(string $modifier): void
    8068
    */
    8169
    public function withTimeZone(\DateTimeZone|string $timezone): static
    8270
    {
    83-
    if (\PHP_VERSION_ID >= 80300 && \is_string($timezone)) {
    71+
    if (\is_string($timezone)) {
    8472
    $timezone = new \DateTimeZone($timezone);
    8573
    } elseif (\is_string($timezone)) {
    8674
    try {

    src/Symfony/Component/Clock/MonotonicClock.php

    Lines changed: 1 addition & 7 deletions
    Original file line numberDiff line numberDiff line change
    @@ -75,14 +75,8 @@ public function sleep(float|int $seconds): void
    7575
    */
    7676
    public function withTimeZone(\DateTimeZone|string $timezone): static
    7777
    {
    78-
    if (\PHP_VERSION_ID >= 80300 && \is_string($timezone)) {
    78+
    if (\is_string($timezone)) {
    7979
    $timezone = new \DateTimeZone($timezone);
    80-
    } elseif (\is_string($timezone)) {
    81-
    try {
    82-
    $timezone = new \DateTimeZone($timezone);
    83-
    } catch (\Exception $e) {
    84-
    throw new \DateInvalidTimeZoneException($e->getMessage(), $e->getCode(), $e);
    85-
    }
    8680
    }
    8781

    8882
    $clone = clone $this;

    0 commit comments

    Comments
     (0)
    0