Skip to content

Commit 84e3b5a

Browse files
committed
No need to do preg_quote on a constant.. We know the answer
1 parent fa57f34 commit 84e3b5a

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/AbstractCachePool.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ abstract class AbstractCachePool implements CacheItemPoolInterface, TaggablePool
2626
{
2727
use TaggablePoolTrait;
2828

29-
/**
30-
* List of invalid (or reserved) key characters.
31-
*
32-
* @type string
33-
*/
34-
const KEY_INVALID_CHARACTERS = '{}()/\@:';
35-
3629
/**
3730
* @type CacheItemInterface[] deferred
3831
*/
@@ -245,12 +238,10 @@ protected function validateKey($key)
245238
));
246239
}
247240

248-
$invalid = preg_quote(static::KEY_INVALID_CHARACTERS, '|');
249-
if (preg_match('|['.$invalid.']|', $key)) {
241+
if (preg_match('|[\{\}\(\)/\\@\:]|', $key)) {
250242
throw new InvalidArgumentException(sprintf(
251-
'Invalid key: "%s". The key contains one or more characters reserved for future extension: %s',
252-
$key,
253-
static::KEY_INVALID_CHARACTERS
243+
'Invalid key: "%s". The key contains one or more characters reserved for future extension: {}()/\@:',
244+
$key
254245
));
255246
}
256247
}

0 commit comments

Comments
 (0)