@@ -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 | } |
@@ -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 | /** |
@@ -208,7 +208,7 @@ |
||
| 208 | 208 | * Reset the Item |
| 209 | 209 | */ |
| 210 | 210 | $item->set(null) |
| 211 | - ->expiresAfter(abs((int)$this->getConfig()->getDefaultTtl())) |
|
| 211 | + ->expiresAfter(abs((int) $this->getConfig()->getDefaultTtl())) |
|
| 212 | 212 | ->setHit(false) |
| 213 | 213 | ->setTags([]); |
| 214 | 214 | if ($this->getConfig()->isItemDetailedDate()) { |
@@ -97,7 +97,7 @@ |
||
| 97 | 97 | /** |
| 98 | 98 | * CouchbaseBucket::get() returns a GetResult interface |
| 99 | 99 | */ |
| 100 | - return $this->decodeDocument((array)$this->getCollection()->get($item->getEncodedKey())->content()); |
|
| 100 | + return $this->decodeDocument((array) $this->getCollection()->get($item->getEncodedKey())->content()); |
|
| 101 | 101 | } catch (DocumentNotFoundException) { |
| 102 | 102 | return null; |
| 103 | 103 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * UNIX ENDPOINT: unix:///tmp/arangodb.sock |
| 35 | 35 | * Failover ENDPOINTS: ['tcp://127.0.0.1:8529', 'tcp://127.0.0.1:8529'] |
| 36 | 36 | */ |
| 37 | - protected string|array $endpoint = 'tcp://127.0.0.1:8529'; |
|
| 37 | + protected string | array $endpoint = 'tcp://127.0.0.1:8529'; |
|
| 38 | 38 | |
| 39 | 39 | protected string $connection = 'Keep-Alive'; // enum{'Close', 'Keep-Alive'} |
| 40 | 40 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | return $this; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - public function getEndpoint(): string|array |
|
| 95 | + public function getEndpoint(): string | array |
|
| 96 | 96 | { |
| 97 | 97 | return $this->endpoint; |
| 98 | 98 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | /** |
| 101 | 101 | * @throws PhpfastcacheLogicException |
| 102 | 102 | */ |
| 103 | - public function setEndpoint(string|array $endpoint): Config |
|
| 103 | + public function setEndpoint(string | array $endpoint): Config |
|
| 104 | 104 | { |
| 105 | 105 | $this->enforceLockedProperty(__FUNCTION__); |
| 106 | 106 | $this->endpoint = $endpoint; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | /** |
| 157 | 157 | * @return callable|string |
| 158 | 158 | */ |
| 159 | - public function getDefaultKeyHashFunction(): callable|string |
|
| 159 | + public function getDefaultKeyHashFunction(): callable | string |
|
| 160 | 160 | { |
| 161 | 161 | return $this->defaultKeyHashFunction; |
| 162 | 162 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * @throws PhpfastcacheInvalidConfigurationException |
| 168 | 168 | * @throws PhpfastcacheLogicException |
| 169 | 169 | */ |
| 170 | - public function setDefaultKeyHashFunction(callable|string $defaultKeyHashFunction): static |
|
| 170 | + public function setDefaultKeyHashFunction(callable | string $defaultKeyHashFunction): static |
|
| 171 | 171 | { |
| 172 | 172 | $this->enforceLockedProperty(__FUNCTION__); |
| 173 | 173 | if ($defaultKeyHashFunction && !\is_callable($defaultKeyHashFunction) && (\is_string($defaultKeyHashFunction) && !\function_exists($defaultKeyHashFunction))) { |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | /** |
| 181 | 181 | * @return callable|string |
| 182 | 182 | */ |
| 183 | - public function getDefaultFileNameHashFunction(): callable|string |
|
| 183 | + public function getDefaultFileNameHashFunction(): callable | string |
|
| 184 | 184 | { |
| 185 | 185 | return $this->defaultFileNameHashFunction; |
| 186 | 186 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @throws PhpfastcacheInvalidConfigurationException |
| 192 | 192 | * @throws PhpfastcacheLogicException |
| 193 | 193 | */ |
| 194 | - public function setDefaultFileNameHashFunction(callable|string $defaultFileNameHashFunction): static |
|
| 194 | + public function setDefaultFileNameHashFunction(callable | string $defaultFileNameHashFunction): static |
|
| 195 | 195 | { |
| 196 | 196 | $this->enforceLockedProperty(__FUNCTION__); |
| 197 | 197 | if (!\is_callable($defaultFileNameHashFunction) && (\is_string($defaultFileNameHashFunction) && !\function_exists($defaultFileNameHashFunction))) { |
@@ -331,8 +331,8 @@ discard block |
||
| 331 | 331 | */ |
| 332 | 332 | protected function getDefaultSuperGlobalAccessor(): \Closure |
| 333 | 333 | { |
| 334 | - return \Closure::fromCallable(static function (string $superGlobalName, ?string $keyName = null) { |
|
| 335 | - return match ($superGlobalName) { |
|
| 334 | + return \Closure::fromCallable(static function(string $superGlobalName, ?string $keyName = null) { |
|
| 335 | + return match($superGlobalName) { |
|
| 336 | 336 | 'SERVER' => $keyName !== null ? $_SERVER[$keyName] ?? null : $_SERVER, |
| 337 | 337 | 'REQUEST' => $keyName !== null ? $_REQUEST[$keyName] ?? null : $_REQUEST, |
| 338 | 338 | 'COOKIE' => $keyName !== null ? $_COOKIE[$keyName] ?? null : $_COOKIE, |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | { |
| 99 | 99 | $config = self::validateConfig($config); |
| 100 | 100 | $driver = self::standardizeDriverName($driver); |
| 101 | - $instanceId = $instanceId ?: md5($driver . \serialize(\array_filter($config->toArray(), static fn ($val) => !\is_callable($val)))); |
|
| 101 | + $instanceId = $instanceId ?: md5($driver . \serialize(\array_filter($config->toArray(), static fn($val) => !\is_callable($val)))); |
|
| 102 | 102 | |
| 103 | 103 | if (!isset(self::$instances[$instanceId])) { |
| 104 | 104 | $driverClass = self::validateDriverClass(self::getDriverClass($driver)); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $found = false; |
| 223 | 223 | self::$instances = \array_filter( |
| 224 | 224 | \array_map( |
| 225 | - static function (ExtendedCacheItemPoolInterface $cachePool) use ($cachePoolInstance, &$found) { |
|
| 225 | + static function(ExtendedCacheItemPoolInterface $cachePool) use ($cachePoolInstance, &$found) { |
|
| 226 | 226 | if (\spl_object_hash($cachePool) === \spl_object_hash($cachePoolInstance)) { |
| 227 | 227 | $found = true; |
| 228 | 228 | return null; |