@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | return $this; |
231 | 231 | } |
232 | 232 | |
233 | - public function append(array|string $data): ExtendedCacheItemInterface |
|
233 | + public function append(array | string $data): ExtendedCacheItemInterface |
|
234 | 234 | { |
235 | 235 | if (\is_array($this->data)) { |
236 | 236 | $this->data[] = $data; |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | return $this; |
242 | 242 | } |
243 | 243 | |
244 | - public function prepend(array|string $data): ExtendedCacheItemInterface |
|
244 | + public function prepend(array | string $data): ExtendedCacheItemInterface |
|
245 | 245 | { |
246 | 246 | if (\is_array($this->data)) { |
247 | 247 | \array_unshift($this->data, $data); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @return ExtendedCacheItemInterface |
158 | 158 | * @throws PhpfastcacheInvalidArgumentException |
159 | 159 | */ |
160 | - public function append(array|string $data): ExtendedCacheItemInterface; |
|
160 | + public function append(array | string $data): ExtendedCacheItemInterface; |
|
161 | 161 | |
162 | 162 | /** |
163 | 163 | * @param array|string $data |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @return ExtendedCacheItemInterface |
166 | 166 | * @throws PhpfastcacheInvalidArgumentException |
167 | 167 | */ |
168 | - public function prepend(array|string $data): ExtendedCacheItemInterface; |
|
168 | + public function prepend(array | string $data): ExtendedCacheItemInterface; |
|
169 | 169 | |
170 | 170 | /** |
171 | 171 | * Return the data as a well-formatted string. |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | { |
113 | 113 | $driverResponse = $this->getItem($this->getTagKey($tagName)); |
114 | 114 | if ($driverResponse->isHit()) { |
115 | - $tagsItems = (array)$driverResponse->get(); |
|
115 | + $tagsItems = (array) $driverResponse->get(); |
|
116 | 116 | |
117 | 117 | /** |
118 | 118 | * getItems() may provide expired item(s) |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | return \array_filter( |
128 | 128 | $this->getItems(\array_unique(\array_keys($tagsItems))), |
129 | - static fn (ExtendedCacheItemInterface $item) => $item->isHit(), |
|
129 | + static fn(ExtendedCacheItemInterface $item) => $item->isHit(), |
|
130 | 130 | ); |
131 | 131 | } |
132 | 132 | return []; |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @throws PhpfastcacheLogicException |
310 | 310 | * @throws \ReflectionException |
311 | 311 | */ |
312 | - public function appendItemsByTags(array $tagNames, array|string $data, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool |
|
312 | + public function appendItemsByTags(array $tagNames, array | string $data, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool |
|
313 | 313 | { |
314 | 314 | $return = true; |
315 | 315 | foreach ($tagNames as $tagName) { |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @throws PhpfastcacheLogicException |
334 | 334 | * @throws \ReflectionException |
335 | 335 | */ |
336 | - public function appendItemsByTag(string $tagName, array|string $data, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool |
|
336 | + public function appendItemsByTag(string $tagName, array | string $data, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool |
|
337 | 337 | { |
338 | 338 | foreach ($this->getItemsByTag($tagName, $strategy) as $item) { |
339 | 339 | $item->append($data); |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * @throws PhpfastcacheLogicException |
355 | 355 | * @throws \ReflectionException |
356 | 356 | */ |
357 | - public function prependItemsByTags(array $tagNames, array|string $data, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool |
|
357 | + public function prependItemsByTags(array $tagNames, array | string $data, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool |
|
358 | 358 | { |
359 | 359 | $return = true; |
360 | 360 | foreach ($tagNames as $tagName) { |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | * @throws PhpfastcacheLogicException |
379 | 379 | * @throws \ReflectionException |
380 | 380 | */ |
381 | - public function prependItemsByTag(string $tagName, array|string $data, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool |
|
381 | + public function prependItemsByTag(string $tagName, array | string $data, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool |
|
382 | 382 | { |
383 | 383 | foreach ($this->getItemsByTag($tagName, $strategy) as $item) { |
384 | 384 | $item->prepend($data); |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * that has slow performances |
448 | 448 | */ |
449 | 449 | |
450 | - $tagsItem->set(\array_merge((array)$data, [$item->getKey() => $expTimestamp])) |
|
450 | + $tagsItem->set(\array_merge((array) $data, [$item->getKey() => $expTimestamp])) |
|
451 | 451 | ->expiresAt($item->getExpirationDate()); |
452 | 452 | |
453 | 453 | $this->driverWrite($tagsItem); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | $tagsItems = $this->getItems($this->getTagKeys($item->getRemovedTags())); |
462 | 462 | |
463 | 463 | foreach ($tagsItems as $tagsItem) { |
464 | - $data = (array)$tagsItem->get(); |
|
464 | + $data = (array) $tagsItem->get(); |
|
465 | 465 | |
466 | 466 | unset($data[$item->getKey()]); |
467 | 467 | $tagsItem->set($data); |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | protected function getTagKeys(array $keys): array |
493 | 493 | { |
494 | 494 | return \array_map( |
495 | - fn (string $key) => $this->getTagKey($key), |
|
495 | + fn(string $key) => $this->getTagKey($key), |
|
496 | 496 | $keys |
497 | 497 | ); |
498 | 498 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return string |
70 | 70 | * @throws PhpfastcacheIOException |
71 | 71 | */ |
72 | - protected function getFilePath(string|bool $keyword, bool $skip = false): string |
|
72 | + protected function getFilePath(string | bool $keyword, bool $skip = false): string |
|
73 | 73 | { |
74 | 74 | $path = $this->getPath(); |
75 | 75 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | throw new PhpfastcacheIOException("Cannot read file located at: $file"); |
283 | 283 | } |
284 | 284 | if (\function_exists('file_get_contents')) { |
285 | - return (string)\file_get_contents($file); |
|
285 | + return (string) \file_get_contents($file); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | $string = ''; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | dirname($file) . \DIRECTORY_SEPARATOR . 'tmp_' . $this->getConfig()->getDefaultFileNameHashFunction()( |
328 | 328 | \bin2hex(\random_bytes(16)) |
329 | 329 | ) |
330 | - ) . '.' . $this->getConfig()->getCacheFileExtension() . \random_int(1000, 9999); |
|
330 | + ) . '.' . $this->getConfig()->getCacheFileExtension() . \random_int(1000, 9999); |
|
331 | 331 | |
332 | 332 | $handle = \fopen($tmpFilename, 'w+b'); |
333 | 333 | if (\is_resource($handle)) { |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * MUST be thrown. |
227 | 227 | * |
228 | 228 | */ |
229 | - public function appendItemsByTag(string $tagName, array|string $data, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
229 | + public function appendItemsByTag(string $tagName, array | string $data, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
230 | 230 | |
231 | 231 | /** |
232 | 232 | * Append the items from the pool by one of multiple tag names. |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * MUST be thrown. |
246 | 246 | * |
247 | 247 | */ |
248 | - public function appendItemsByTags(array $tagNames, array|string $data, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
248 | + public function appendItemsByTags(array $tagNames, array | string $data, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
249 | 249 | |
250 | 250 | /** |
251 | 251 | * Prepend the items from the pool by tag. |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * MUST be thrown. |
265 | 265 | * |
266 | 266 | */ |
267 | - public function prependItemsByTag(string $tagName, array|string $data, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
267 | + public function prependItemsByTag(string $tagName, array | string $data, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
268 | 268 | |
269 | 269 | /** |
270 | 270 | * Prepend the items from the pool by one of multiple tag names. |
@@ -283,5 +283,5 @@ discard block |
||
283 | 283 | * MUST be thrown. |
284 | 284 | * |
285 | 285 | */ |
286 | - public function prependItemsByTags(array $tagNames, array|string $data, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
286 | + public function prependItemsByTags(array $tagNames, array | string $data, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
287 | 287 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | |
36 | 36 | protected ConfigurationOption $config; |
37 | 37 | |
38 | - protected object|array|null $instance; |
|
38 | + protected object | array | null $instance; |
|
39 | 39 | |
40 | 40 | protected string $driverName; |
41 | 41 |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $config = self::validateConfig($config); |
141 | 141 | $driver = self::standardizeDriverName($driver); |
142 | 142 | |
143 | - $instanceId = $instanceId ?: md5($driver . \serialize(\array_filter($config->toArray(), static fn ($val) => !\is_callable($val)))); |
|
143 | + $instanceId = $instanceId ?: md5($driver . \serialize(\array_filter($config->toArray(), static fn($val) => !\is_callable($val)))); |
|
144 | 144 | |
145 | 145 | if (!isset(self::$instances[$instanceId])) { |
146 | 146 | $driverClass = self::validateDriverClass(self::getDriverClass($driver)); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $found = false; |
264 | 264 | self::$instances = \array_filter( |
265 | 265 | \array_map( |
266 | - static function (ExtendedCacheItemPoolInterface $cachePool) use ($cachePoolInstance, &$found) { |
|
266 | + static function(ExtendedCacheItemPoolInterface $cachePool) use ($cachePoolInstance, &$found) { |
|
267 | 267 | if (\spl_object_hash($cachePool) === \spl_object_hash($cachePoolInstance)) { |
268 | 268 | $found = true; |
269 | 269 | return null; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | public function getItem(string $key): ExtendedCacheItemInterface |
55 | 55 | { |
56 | 56 | return $this->getStandardizedItem( |
57 | - $this->makeOperation(static fn (ExtendedCacheItemPoolInterface $pool) => $pool->getItem($key)) ?? new Item($this, $key), |
|
57 | + $this->makeOperation(static fn(ExtendedCacheItemPoolInterface $pool) => $pool->getItem($key)) ?? new Item($this, $key), |
|
58 | 58 | $this |
59 | 59 | ); |
60 | 60 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | public function hasItem(string $key): bool |
105 | 105 | { |
106 | 106 | return $this->makeOperation( |
107 | - static fn (ExtendedCacheItemPoolInterface $pool) => $pool->hasItem($key) |
|
107 | + static fn(ExtendedCacheItemPoolInterface $pool) => $pool->hasItem($key) |
|
108 | 108 | ); |
109 | 109 | } |
110 | 110 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | public function clear(): bool |
115 | 115 | { |
116 | 116 | return $this->makeOperation( |
117 | - static fn (ExtendedCacheItemPoolInterface $pool) => $pool->clear() |
|
117 | + static fn(ExtendedCacheItemPoolInterface $pool) => $pool->clear() |
|
118 | 118 | ); |
119 | 119 | } |
120 | 120 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | public function deleteItem(string $key): bool |
125 | 125 | { |
126 | 126 | return $this->makeOperation( |
127 | - static fn (ExtendedCacheItemPoolInterface $pool) => $pool->deleteItem($key) |
|
127 | + static fn(ExtendedCacheItemPoolInterface $pool) => $pool->deleteItem($key) |
|
128 | 128 | ); |
129 | 129 | } |
130 | 130 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | public function save(CacheItemInterface $item): bool |
135 | 135 | { |
136 | 136 | return $this->makeOperation( |
137 | - function (ExtendedCacheItemPoolInterface $pool) use ($item) { |
|
137 | + function(ExtendedCacheItemPoolInterface $pool) use ($item) { |
|
138 | 138 | /** @var ExtendedCacheItemInterface $item */ |
139 | 139 | $item->setHit(true); |
140 | 140 | return $pool->save($this->getStandardizedItem($item, $pool)); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | public function commit(): bool |
150 | 150 | { |
151 | 151 | return $this->makeOperation( |
152 | - static fn (ExtendedCacheItemPoolInterface $pool) => $pool->commit() |
|
152 | + static fn(ExtendedCacheItemPoolInterface $pool) => $pool->commit() |
|
153 | 153 | ); |
154 | 154 | } |
155 | 155 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | { |
111 | 111 | $this->assertCacheItemType($item, Item::class); |
112 | 112 | |
113 | - return (bool)$this->instance->setx($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), $item->getTtl()); |
|
113 | + return (bool) $this->instance->setx($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), $item->getTtl()); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $this->assertCacheItemType($item, Item::class); |
124 | 124 | |
125 | - return (bool)$this->instance->del($item->getEncodedKey()); |
|
125 | + return (bool) $this->instance->del($item->getEncodedKey()); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |