8000 minor #46513 [Cache][Lock][VarExporter] Remove dead branches of PHP v… · symfony/symfony@2424b43 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2424b43

Browse files
minor #46513 [Cache][Lock][VarExporter] Remove dead branches of PHP version checks (derrabus)
This PR was merged into the 6.2 branch. Discussion ---------- [Cache][Lock][VarExporter] Remove dead branches of PHP version checks | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A This PR removes various code that won't be executed on PHP 8.1 and above. Commits ------- a182410 Remove dead branches of PHP version checks
2 parents f4361fb + a182410 commit 2424b43

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class MemcachedAdapter extends AbstractAdapter
5656
public function __construct(\Memcached $client, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
5757
{
5858
if (!static::isSupported()) {
59-
throw new CacheException('Memcached '.(\PHP_VERSION_ID >= 80100 ? '> 3.1.5' : '>= 2.2.0').' is required.');
59+
throw new CacheException('Memcached > 3.1.5 is required.');
6060
}
6161
if ('Memcached' === \get_class($client)) {
6262
$opt = $client->getOption(\Memcached::OPT_SERIALIZER);
@@ -76,7 +76,7 @@ public function __construct(\Memcached $client, string $namespace = '', int $def
7676

7777
public static function isSupported()
7878
{
79-
return \extension_loaded('memcached') && version_compare(phpversion('memcached'), \PHP_VERSION_ID >= 80100 ? '3.1.6' : '2.2.0', '>=');
79+
return \extension_loaded('memcached') && version_compare(phpversion('memcached'), '3.1.6', '>=');
8080
}
8181

8282
/**
@@ -100,7 +100,7 @@ public static function createConnection(array|string $servers, array $options =
100100
throw new InvalidArgumentException(sprintf('MemcachedAdapter::createClient() expects array or string as first argument, "%s" given.', get_debug_type($servers)));
101101
}
102102
if (!static::isSupported()) {
103-
throw new CacheException('Memcached '.(\PHP_VERSION_ID >= 80100 ? '> 3.1.5' : '>= 2.2.0').' is required.');
103+
throw new CacheException('Memcached > 3.1.5 is required.');
104104
}
105105
set_error_handler(function ($type, $msg, $file, $line) { throw new \ErrorException($msg, 0, $type, $file, $line); });
106106
try {

src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class MemcachedAdapterTest extends AdapterTestCase
3333
public static function setUpBeforeClass(): void
3434
{
3535
if (!MemcachedAdapter::isSupported()) {
36-
throw new SkippedTestSuiteError('Extension memcached '.(\PHP_VERSION_ID >= 80100 ? '> 3.1.5' : '>= 2.2.0').' required.');
36+
throw new SkippedTestSuiteError('Extension memcached > 3.1.5 required.');
3737
}
3838
self::$client = AbstractAdapter::createConnection('memcached://'.getenv('MEMCACHED_HOST'), ['binary_protocol' => false]);
3939
self::$client->get('foo');

src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class MemcachedStoreTest extends AbstractStoreTest
2929

3030
public static function setUpBeforeClass(): void
3131
{
32-
if (version_compare(phpversion('memcached'), \PHP_VERSION_ID >= 80100 ? '3.1.6' : '2.2.0', '<')) {
33-
throw new SkippedTestSuiteError('Extension memcached '.(\PHP_VERSION_ID >= 80100 ? '> 3.1.5' : '>= 2.2.0').' required.');
32+
if (version_compare(phpversion('memcached'), '3.1.6', '<')) {
33+
throw new SkippedTestSuiteError('Extension memcached > 3.1.5 required.');
3434
}
3535

3636
$memcached = new \Memcached();

src/Symfony/Component/VarExporter/Internal/Exporter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public static function prepare($values, $objectsPool, &$refsPool, &$objectsCount
133133
$i = 0;
134134
$n = (string) $name;
135135
if ('' === $n || "\0" !== $n[0]) {
136-
$c = \PHP_VERSION_ID >= 80100 && $reflector->hasProperty($n) && ($p = $reflector->getProperty($n))->isReadOnly() ? $p->class : 'stdClass';
136+
$c = $reflector->hasProperty($n) && ($p = $reflector->getProperty($n))->isReadOnly() ? $p->class : 'stdClass';
137137
} elseif ('*' === $n[1]) {
138138
$n = substr($n, 3);
139139
$c = $reflector->getProperty($n)->class;

src/Symfony/Component/VarExporter/Tests/VarExporterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function provideExport()
131131
new \DatePeriod($start, $interval, 4),
132132
]];
133133

134-
$value = \PHP_VERSION_ID >= 70406 ? new ArrayObject() : new \ArrayObject();
134+
$value = new ArrayObject();
135135
$value[0] = 1;
136136
$value->foo = new \ArrayObject();
137137
$value[1] = $value;

0 commit comments

Comments
 (0)
0