8000 [Cache][Lock][VarExporter] Remove dead branches of PHP version checks by derrabus · Pull Request #46513 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
10000
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class MemcachedAdapter extends AbstractAdapter
public function __construct(\Memcached $client, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
{
if (!static::isSupported()) {
throw new CacheException('Memcached '.(\PHP_VERSION_ID >= 80100 ? '> 3.1.5' : '>= 2.2.0').' is required.');
throw new CacheException('Memcached > 3.1.5 is required.');
}
if ('Memcached' === \get_class($client)) {
$opt = $client->getOption(\Memcached::OPT_SERIALIZER);
Expand All @@ -76,7 +76,7 @@ public function __construct(\Memcached $client, string $namespace = '', int $def

public static function isSupported()
{
return \extension_loaded('memcached') && version_compare(phpversion('memcached'), \PHP_VERSION_ID >= 80100 ? '3.1.6' : '2.2.0', '>=');
return \extension_loaded('memcached') && version_compare(phpversion('memcached'), '3.1.6', '>=');
}

/**
Expand All @@ -100,7 +100,7 @@ public static function createConnection(array|string $servers, array $options =
throw new InvalidArgumentException(sprintf('MemcachedAdapter::createClient() expects array or string as first argument, "%s" given.', get_debug_type($servers)));
}
if (!static::isSupported()) {
throw new CacheException('Memcached '.(\PHP_VERSION_ID >= 80100 ? '> 3.1.5' : '>= 2.2.0').' is required.');
throw new CacheException('Memcached > 3.1.5 is required.');
}
set_error_handler(function ($type, $msg, $file, $line) { throw new \ErrorException($msg, 0, $type, $file, $line); });
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MemcachedAdapterTest extends AdapterTestCase
public static function setUpBeforeClass(): void
{
if (!MemcachedAdapter::isSupported()) {
throw new SkippedTestSuiteError('Extension memcached '.(\PHP_VERSION_ID >= 80100 ? '> 3.1.5' : '>= 2.2.0').' required.');
throw new SkippedTestSuiteError('Extension memcached > 3.1.5 required.');
}
self::$client = AbstractAdapter::createConnection('memcached://'.getenv('MEMCACHED_HOST'), ['binary_protocol' => false]);
self::$client->get('foo');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class MemcachedStoreTest extends AbstractStoreTest

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

$memcached = new \Memcached();
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/VarExporter/Internal/Exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public static function prepare($values, $objectsPool, &$refsPool, &$objectsCount
$i = 0;
$n = (string) $name;
if ('' === $n || "\0" !== $n[0]) {
$c = \PHP_VERSION_ID >= 80100 && $reflector->hasProperty($n) && ($p = $reflector->getProperty($n))->isReadOnly() ? $p->class : 'stdClass';
$c = $reflector->hasProperty($n) && ($p = $reflector->getProperty($n))->isReadOnly() ? $p->class : 'stdClass';
} elseif ('*' === $n[1]) {
$n = substr($n, 3);
$c = $reflector->getProperty($n)->class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function provideExport()
new \DatePeriod($start, $interval, 4),
]];

$value = \PHP_VERSION_ID >= 70406 ? new ArrayObject() : new \ArrayObject();
$value = new ArrayObject();
$value[0] = 1;
$value->foo = new \ArrayObject();
$value[1] = $value;
Expand Down
0