@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * @throws InvalidArgumentException |
| 33 | 33 | */ |
| 34 | - public function get(string $cacheKey, callable $callback, DateInterval|int $expiresAfter = null): mixed |
|
| 34 | + public function get(string $cacheKey, callable $callback, DateInterval | int $expiresAfter = null): mixed |
|
| 35 | 35 | { |
| 36 | 36 | $cacheItem = $this->cacheInstance->getItem($cacheKey); |
| 37 | 37 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * @throws InvalidArgumentException |
| 55 | 55 | */ |
| 56 | - public function __invoke(string $cacheKey, callable $callback, DateInterval|int $expiresAfter = null): mixed |
|
| 56 | + public function __invoke(string $cacheKey, callable $callback, DateInterval | int $expiresAfter = null): mixed |
|
| 57 | 57 | { |
| 58 | 58 | return $this->get($cacheKey, $callback, $expiresAfter); |
| 59 | 59 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $this->database->selectCollection($collectionName) |
| 101 | 101 | ->createIndex( |
| 102 | 102 | [self::DRIVER_EDATE_WRAPPER_INDEX => 1], |
| 103 | - ['expireAfterSeconds' => 0, 'name' => 'auto_expire_index'] |
|
| 103 | + ['expireAfterSeconds' => 0, 'name' => 'auto_expire_index'] |
|
| 104 | 104 | ); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | ) |
| 232 | 232 | )->toArray()[0]; |
| 233 | 233 | |
| 234 | - $arrayFilterRecursive = static function ($array, callable $callback = null) use (&$arrayFilterRecursive) { |
|
| 234 | + $arrayFilterRecursive = static function($array, callable $callback = null) use (&$arrayFilterRecursive) { |
|
| 235 | 235 | $array = $callback($array); |
| 236 | 236 | |
| 237 | 237 | if (\is_object($array) || \is_array($array)) { |
@@ -243,12 +243,12 @@ discard block |
||
| 243 | 243 | return $array; |
| 244 | 244 | }; |
| 245 | 245 | |
| 246 | - $callback = static function ($item) { |
|
| 246 | + $callback = static function($item) { |
|
| 247 | 247 | /** |
| 248 | 248 | * Remove unserializable properties |
| 249 | 249 | */ |
| 250 | 250 | if ($item instanceof UTCDateTime) { |
| 251 | - return (string)$item; |
|
| 251 | + return (string) $item; |
|
| 252 | 252 | } |
| 253 | 253 | return $item; |
| 254 | 254 | }; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * UNIX ENDPOINT: unix:///tmp/arangodb.sock |
| 34 | 34 | * Failover ENDPOINTS: ['tcp://127.0.0.1:8529', 'tcp://127.0.0.1:8529'] |
| 35 | 35 | */ |
| 36 | - protected string|array $endpoint = 'tcp://127.0.0.1:8529'; |
|
| 36 | + protected string | array $endpoint = 'tcp://127.0.0.1:8529'; |
|
| 37 | 37 | protected string $connection = 'Keep-Alive'; |
| 38 | 38 | // enum{'Close', 'Keep-Alive'} |
| 39 | 39 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | return $this; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - public function getEndpoint(): string|array |
|
| 88 | + public function getEndpoint(): string | array |
|
| 89 | 89 | { |
| 90 | 90 | return $this->endpoint; |
| 91 | 91 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | /** |
| 94 | 94 | * @throws PhpfastcacheLogicException |
| 95 | 95 | */ |
| 96 | - public function setEndpoint(string|array $endpoint): Config |
|
| 96 | + public function setEndpoint(string | array $endpoint): Config |
|
| 97 | 97 | { |
| 98 | 98 | $this->enforceLockedProperty(__FUNCTION__); |
| 99 | 99 | $this->endpoint = $endpoint; |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | /** |
| 166 | 166 | * @return callable|string |
| 167 | 167 | */ |
| 168 | - public function getDefaultKeyHashFunction(): callable|string |
|
| 168 | + public function getDefaultKeyHashFunction(): callable | string |
|
| 169 | 169 | { |
| 170 | 170 | return $this->defaultKeyHashFunction; |
| 171 | 171 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @throws PhpfastcacheInvalidConfigurationException |
| 177 | 177 | * @throws PhpfastcacheLogicException |
| 178 | 178 | */ |
| 179 | - public function setDefaultKeyHashFunction(callable|string $defaultKeyHashFunction): static |
|
| 179 | + public function setDefaultKeyHashFunction(callable | string $defaultKeyHashFunction): static |
|
| 180 | 180 | { |
| 181 | 181 | $this->enforceLockedProperty(__FUNCTION__); |
| 182 | 182 | if ($defaultKeyHashFunction && !\is_callable($defaultKeyHashFunction) && (\is_string($defaultKeyHashFunction) && !\function_exists($defaultKeyHashFunction))) { |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | /** |
| 190 | 190 | * @return callable|string |
| 191 | 191 | */ |
| 192 | - public function getDefaultFileNameHashFunction(): callable|string |
|
| 192 | + public function getDefaultFileNameHashFunction(): callable | string |
|
| 193 | 193 | { |
| 194 | 194 | return $this->defaultFileNameHashFunction; |
| 195 | 195 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * @throws PhpfastcacheInvalidConfigurationException |
| 201 | 201 | * @throws PhpfastcacheLogicException |
| 202 | 202 | */ |
| 203 | - public function setDefaultFileNameHashFunction(callable|string $defaultFileNameHashFunction): static |
|
| 203 | + public function setDefaultFileNameHashFunction(callable | string $defaultFileNameHashFunction): static |
|
| 204 | 204 | { |
| 205 | 205 | $this->enforceLockedProperty(__FUNCTION__); |
| 206 | 206 | if (!\is_callable($defaultFileNameHashFunction) && (\is_string($defaultFileNameHashFunction) && !\function_exists($defaultFileNameHashFunction))) { |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | protected function getDefaultSuperGlobalAccessor(): \Closure |
| 343 | 343 | { |
| 344 | - return \Closure::fromCallable(static function (string $superGlobalName, ?string $keyName = null): string|int|float|array|bool|null { |
|
| 344 | + return \Closure::fromCallable(static function(string $superGlobalName, ?string $keyName = null): string | int | float | array | bool | null { |
|
| 345 | 345 | return match ($superGlobalName) { |
| 346 | 346 | 'SERVER' => $keyName !== null ? $_SERVER[$keyName] ?? null : $_SERVER, |
| 347 | 347 | 'REQUEST' => $keyName !== null ? $_REQUEST[$keyName] ?? null : $_REQUEST, |
@@ -186,7 +186,7 @@ |
||
| 186 | 186 | * @return bool |
| 187 | 187 | * True if the item was successfully persisted. False if there was an error. |
| 188 | 188 | */ |
| 189 | - public function save(ExtendedCacheItemInterface|CacheItemInterface $item): bool; |
|
| 189 | + public function save(ExtendedCacheItemInterface | CacheItemInterface $item): bool; |
|
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | 192 | * Save multiple items, possible uses: |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | $driverResponse = $this->getItem($this->getTagKey($tagName)); |
| 115 | 115 | if ($driverResponse->isHit()) { |
| 116 | - $tagsItems = (array)$driverResponse->get(); |
|
| 116 | + $tagsItems = (array) $driverResponse->get(); |
|
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | 119 | * getItems() may provide expired item(s) |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | * @throws PhpfastcacheLogicException |
| 311 | 311 | * @throws \ReflectionException |
| 312 | 312 | */ |
| 313 | - public function appendItemsByTags(array $tagNames, array|string $data, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool |
|
| 313 | + public function appendItemsByTags(array $tagNames, array | string $data, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool |
|
| 314 | 314 | { |
| 315 | 315 | $return = true; |
| 316 | 316 | foreach ($tagNames as $tagName) { |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | * @throws PhpfastcacheLogicException |
| 335 | 335 | * @throws \ReflectionException |
| 336 | 336 | */ |
| 337 | - public function appendItemsByTag(string $tagName, array|string $data, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool |
|
| 337 | + public function appendItemsByTag(string $tagName, array | string $data, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool |
|
| 338 | 338 | { |
| 339 | 339 | foreach ($this->getItemsByTag($tagName, $strategy) as $item) { |
| 340 | 340 | $item->append($data); |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | * @throws PhpfastcacheLogicException |
| 356 | 356 | * @throws \ReflectionException |
| 357 | 357 | */ |
| 358 | - public function prependItemsByTags(array $tagNames, array|string $data, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool |
|
| 358 | + public function prependItemsByTags(array $tagNames, array | string $data, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool |
|
| 359 | 359 | { |
| 360 | 360 | $return = true; |
| 361 | 361 | foreach ($tagNames as $tagName) { |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | * @throws PhpfastcacheLogicException |
| 380 | 380 | * @throws \ReflectionException |
| 381 | 381 | */ |
| 382 | - public function prependItemsByTag(string $tagName, array|string $data, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool |
|
| 382 | + public function prependItemsByTag(string $tagName, array | string $data, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): bool |
|
| 383 | 383 | { |
| 384 | 384 | foreach ($this->getItemsByTag($tagName, $strategy) as $item) { |
| 385 | 385 | $item->prepend($data); |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | * that has slow performances |
| 449 | 449 | */ |
| 450 | 450 | |
| 451 | - $tagsItem->set(\array_merge((array)$data, [$item->getKey() => $expTimestamp])) |
|
| 451 | + $tagsItem->set(\array_merge((array) $data, [$item->getKey() => $expTimestamp])) |
|
| 452 | 452 | ->expiresAt($item->getExpirationDate()); |
| 453 | 453 | |
| 454 | 454 | $this->driverWrite($tagsItem); |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | $tagsItems = $this->getItems($this->getTagKeys($item->getRemovedTags())); |
| 463 | 463 | |
| 464 | 464 | foreach ($tagsItems as $tagsItem) { |
| 465 | - $data = (array)$tagsItem->get(); |
|
| 465 | + $data = (array) $tagsItem->get(); |
|
| 466 | 466 | |
| 467 | 467 | unset($data[$item->getKey()]); |
| 468 | 468 | $tagsItem->set($data); |
@@ -219,7 +219,7 @@ |
||
| 219 | 219 | ); |
| 220 | 220 | |
| 221 | 221 | $stats->setSize( |
| 222 | - (int)\array_sum( |
|
| 222 | + (int) \array_sum( |
|
| 223 | 223 | \array_map( |
| 224 | 224 | static fn (ExtendedCacheItemPoolInterface $pool) => $pool->getStats()->getSize(), |
| 225 | 225 | $this->clusterPools |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @return bool |
| 89 | 89 | * @throws PhpfastcacheSimpleCacheException |
| 90 | 90 | */ |
| 91 | - public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool |
|
| 91 | + public function set(string $key, mixed $value, null | int | \DateInterval $ttl = null): bool |
|
| 92 | 92 | { |
| 93 | 93 | try { |
| 94 | 94 | $cacheItem = $this->internalCacheInstance |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @return bool |
| 161 | 161 | * @throws PhpfastcacheSimpleCacheException |
| 162 | 162 | */ |
| 163 | - public function setMultiple(iterable $values, null|int|\DateInterval $ttl = null): bool |
|
| 163 | + public function setMultiple(iterable $values, null | int | \DateInterval $ttl = null): bool |
|
| 164 | 164 | { |
| 165 | 165 | try { |
| 166 | 166 | foreach ($values as $key => $value) { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | protected ConfigurationOptionInterface $config; |
| 46 | 46 | |
| 47 | - protected object|array|null $instance; |
|
| 47 | + protected object | array | null $instance; |
|
| 48 | 48 | |
| 49 | 49 | protected string $driverName; |
| 50 | 50 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | ]; |
| 151 | 151 | |
| 152 | 152 | if ($this->getConfig()->isItemDetailedDate()) { |
| 153 | - $wrap[ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX] = new DateTime();// Always on the latest date |
|
| 153 | + $wrap[ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX] = new DateTime(); // Always on the latest date |
|
| 154 | 154 | /** |
| 155 | 155 | * If the creation date exists |
| 156 | 156 | * reuse it else set a new Date |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if ($stringifyDate) { |
| 165 | - \array_walk($wrap, static function (mixed &$value, string $key): void { |
|
| 165 | + \array_walk($wrap, static function(mixed &$value, string $key): void { |
|
| 166 | 166 | if ($value instanceof DateTimeInterface && $key !== ExtendedCacheItemPoolInterface::DRIVER_DATA_WRAPPER_INDEX) { |
| 167 | 167 | $value = $value->format(DateTimeInterface::W3C); |
| 168 | 168 | } |