Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3ccc634

Browse files
[Cache] Deprecate CouchbaseBucketAdapter, use CouchbaseCollectionAdapter
1 parent c4e97eb commit 3ccc634

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

UPGRADE-7.1.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
UPGRADE FROM 7.0 to 7.1
22
=======================
33

4+
Cache
5+
-----
6+
7+
* Deprecate `CouchbaseBucketAdapter`, use `CouchbaseCollectionAdapter`
8+
49
Workflow
510
--------
611

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@
1616
use Symfony\Component\Cache\Marshaller\DefaultMarshaller;
1717
use Symfony\Component\Cache\Marshaller\MarshallerInterface;
1818

19+
trigger_deprecation('symfony/cache', '7.1', 'The "%s" class is deprecated, use "%s" instead.', CouchbaseBucketAdapter::class, CouchbaseCollectionAdapter::class);
20+
1921
/**
2022
* @author Antonio Jose Cerezo Aranda <[email protected]>
23+
*
24+
* @deprecated since Symfony 7.1, use {@see CouchbaseCollectionAdapter} instead
2125
*/
2226
class CouchbaseBucketAdapter extends AbstractAdapter
2327
{

src/Symfony/Component/Cache/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Add option `sentinel_master` as an alias for `redis_sentinel`
8+
* Deprecate `CouchbaseBucketAdapter`, use `CouchbaseCollectionAdapter`
89

910
7.0
1011
---

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace Symfony\Component\Cache\Tests\Adapter;
1313

1414
use Psr\Cache\CacheItemPoolInterface;
15+
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
1516
use Symfony\Component\Cache\Adapter\AbstractAdapter;
16-
use Symfony\Component\Cache\Adapter\CouchbaseBucketAdapter;
1717

1818
/**
1919
* @requires extension couchbase <3.0.0
@@ -25,19 +25,19 @@
2525
*/
2626
class CouchbaseBucketAdapterTest extends AdapterTestCase
2727
{
28+
use ExpectDeprecationTrait;
29+
2830
protected $skippedTests = [
2931
'testClearPrefix' => 'Couchbase cannot clear by prefix',
3032
];
3133

32-
protected static \CouchbaseBucket $client;
34+
protected \CouchbaseBucket $client;
3335

34-
public static function setupBeforeClass(): void
36+
protected function setUp(): void
3537
{
36-
if (!CouchbaseBucketAdapter::isSupported()) {
37-
self::markTestSkipped('Couchbase >= 2.6.0 < 3.0.0 is required.');
38-
}
38+
$this->expectDeprecation('Since symfony/cache 7.1: The "Symfony\Component\Cache\Adapter\CouchbaseBucketAdapter" class is deprecated, use "Symfony\Component\Cache\Adapter\CouchbaseCollectionAdapter" instead.');
3939

40-
self::$client = AbstractAdapter::createConnection('couchbase://'.getenv('COUCHBASE_HOST').'/cache',
40+
$this->client = AbstractAdapter::createConnection('couchbase://'.getenv('COUCHBASE_HOST').'/cache',
4141
['username' => getenv('COUCHBASE_USER'), 'password' => getenv('COUCHBASE_PASS')]
4242
);
4343
}
@@ -50,8 +50,8 @@ public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface
5050
.':'.getenv('COUCHBASE_PASS')
5151
.'@'.getenv('COUCHBASE_HOST')
5252
.'/cache')
53-
: self::$client;
53+
: $this->client;
5454

55-
return new CouchbaseBucketAdapter($client, str_replace('\\', '.', __CLASS__), $defaultLifetime);
55+
return new \Symfony\Component\Cache\Adapter\CouchbaseBucketAdapter($client, str_replace('\\', '.', __CLASS__), $defaultLifetime);
5656
}
5757
}

0 commit comments

Comments
 (0)