You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CHANGELOG.md
+1
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
## Unreleased
4
4
5
5
- Fix return type for `TracingDriver::getDatabase()` method (#541)
6
+
- Avoid throwing exception from the `TraceableCacheAdapterTrait::prune()` and `TraceableCacheAdapterTrait::reset()` methods when the decorated adapter does not implement the respective interfaces (#543)
Copy file name to clipboardexpand all lines: src/Tracing/Cache/TraceableCacheAdapterTrait.php
+3-5
Original file line number
Diff line number
Diff line change
@@ -159,7 +159,7 @@ public function prune(): bool
159
159
{
160
160
return$this->traceFunction('cache.prune', function (): bool {
161
161
if (!$this->decoratedAdapterinstanceof PruneableInterface) {
162
-
thrownew \BadMethodCallException(sprintf('The %s::prune() method is not supported because the decorated adapter does not implement the "%s" interface.', self::class, PruneableInterface::class));
162
+
returnfalse;
163
163
}
164
164
165
165
return$this->decoratedAdapter->prune();
@@ -171,11 +171,9 @@ public function prune(): bool
171
171
*/
172
172
publicfunctionreset(): void
173
173
{
174
-
if (!$this->decoratedAdapterinstanceof ResettableInterface) {
175
-
thrownew \BadMethodCallException(sprintf('The %s::reset() method is not supported because the decorated adapter does not implement the "%s" interface.', self::class, ResettableInterface::class));
174
+
if ($this->decoratedAdapterinstanceof ResettableInterface) {
$this->expectExceptionMessage(sprintf('The %s::prune() method is not supported because the decorated adapter does not implement the "Symfony\\Component\\Cache\\PruneableInterface" interface.', \get_class($adapter)));
$this->expectExceptionMessage(sprintf('The %s::reset() method is not supported because the decorated adapter does not implement the "Symfony\\Component\\Cache\\ResettableInterface" interface.', \get_class($adapter)));
0 commit comments