@@ -66,5 +66,5 @@ |
||
66 | 66 | |
67 | 67 | if ((!\defined('PFC_IGNORE_COMPOSER_WARNING') || !PFC_IGNORE_COMPOSER_WARNING) && \class_exists(\Composer\Autoload\ClassLoader::class)) { |
68 | 68 | \trigger_error('Your project already makes use of Composer. You SHOULD use the composer dependency "phpfastcache/phpfastcache" instead of hard-autoloading.', |
69 | - E_USER_WARNING); |
|
69 | + E_USER_WARNING); |
|
70 | 70 | } |
71 | 71 | \ No newline at end of file |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * |
16 | 16 | */ |
17 | 17 | |
18 | -class Autoload{} |
|
18 | +class Autoload {} |
|
19 | 19 | |
20 | 20 | \define('PFC_PHP_EXT', 'php'); |
21 | 21 | \define('PFC_BIN_DIR', __DIR__ . '/../../../bin/'); |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * Register Autoload |
26 | 26 | */ |
27 | -spl_autoload_register(function ($entity) { |
|
27 | +spl_autoload_register(function($entity) { |
|
28 | 28 | $module = \explode('\\', $entity, 2); |
29 | - if (!\in_array($module[ 0 ], ['Phpfastcache', 'Psr'])) { |
|
29 | + if (!\in_array($module[0], ['Phpfastcache', 'Psr'])) { |
|
30 | 30 | /** |
31 | 31 | * Not a part of phpFastCache file |
32 | 32 | * then we return here. |
@@ -41,7 +41,7 @@ |
||
41 | 41 | return true; |
42 | 42 | } else if (\constant($CONSTANT_NAME) !== $driverName) { |
43 | 43 | \trigger_error('Memcache collision detected, you used both Memcache and Memcached driver in your script, this may leads to unexpected behaviours', |
44 | - E_USER_WARNING); |
|
44 | + E_USER_WARNING); |
|
45 | 45 | |
46 | 46 | return false; |
47 | 47 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use Phpfastcache\Config\ConfigurationOption; |
19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - PhpfastcacheDriverCheckException, PhpfastcacheDriverException, PhpfastcacheDriverNotFoundException, PhpfastcacheInstanceNotFoundException, PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidConfigurationException, PhpfastcacheLogicException, PhpfastcacheUnsupportedOperationException |
|
21 | + PhpfastcacheDriverCheckException, PhpfastcacheDriverException, PhpfastcacheDriverNotFoundException, PhpfastcacheInstanceNotFoundException, PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidConfigurationException, PhpfastcacheLogicException, PhpfastcacheUnsupportedOperationException |
|
22 | 22 | }; |
23 | 23 | use Phpfastcache\Util\ClassNamespaceResolverTrait; |
24 | 24 | |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | if (\is_array($config)) { |
116 | 116 | $config = new ConfigurationOption($config); |
117 | 117 | \trigger_error( |
118 | - 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
|
119 | - E_USER_DEPRECATED |
|
118 | + 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
|
119 | + E_USER_DEPRECATED |
|
120 | 120 | ); |
121 | 121 | } elseif ($config === null) { |
122 | 122 | $config = self::getDefaultConfig(); |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | |
139 | 139 | if (!is_a($driverClass, ExtendedCacheItemPoolInterface::class, true)) { |
140 | 140 | throw new PhpfastcacheDriverException(\sprintf( |
141 | - 'Class "%s" does not implement "%s"', |
|
142 | - $driverClass, |
|
143 | - ExtendedCacheItemPoolInterface::class |
|
141 | + 'Class "%s" does not implement "%s"', |
|
142 | + $driverClass, |
|
143 | + ExtendedCacheItemPoolInterface::class |
|
144 | 144 | )); |
145 | 145 | } |
146 | 146 | try { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $fallback = $config->getFallback(); |
158 | 158 | $config->setFallback(''); |
159 | 159 | \trigger_error(\sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, |
160 | - $fallback), E_USER_WARNING); |
|
160 | + $fallback), E_USER_WARNING); |
|
161 | 161 | return self::getInstance($fallback, $config->getFallbackConfig()); |
162 | 162 | } catch (PhpfastcacheInvalidArgumentException $e) { |
163 | 163 | throw new PhpfastcacheInvalidConfigurationException('Invalid fallback driver configuration', 0, $e); |
@@ -332,29 +332,29 @@ discard block |
||
332 | 332 | public static function getStaticSystemDrivers(): array |
333 | 333 | { |
334 | 334 | \trigger_error(\sprintf('Method "%s" is deprecated as of the V7 and will be removed soon or later, use CacheManager::getDriverList() instead.', |
335 | - __METHOD__), E_USER_DEPRECATED); |
|
335 | + __METHOD__), E_USER_DEPRECATED); |
|
336 | 336 | return [ |
337 | - 'Apc', |
|
338 | - 'Apcu', |
|
339 | - 'Cassandra', |
|
340 | - 'Couchbase', |
|
341 | - 'Couchdb', |
|
342 | - 'Devnull', |
|
343 | - 'Files', |
|
344 | - 'Leveldb', |
|
345 | - 'Memcache', |
|
346 | - 'Memcached', |
|
347 | - 'Memstatic', |
|
348 | - 'Mongodb', |
|
349 | - 'Predis', |
|
350 | - 'Redis', |
|
351 | - 'Riak', |
|
352 | - 'Ssdb', |
|
353 | - 'Sqlite', |
|
354 | - 'Wincache', |
|
355 | - 'Xcache', |
|
356 | - 'Zenddisk', |
|
357 | - 'Zendshm', |
|
337 | + 'Apc', |
|
338 | + 'Apcu', |
|
339 | + 'Cassandra', |
|
340 | + 'Couchbase', |
|
341 | + 'Couchdb', |
|
342 | + 'Devnull', |
|
343 | + 'Files', |
|
344 | + 'Leveldb', |
|
345 | + 'Memcache', |
|
346 | + 'Memcached', |
|
347 | + 'Memstatic', |
|
348 | + 'Mongodb', |
|
349 | + 'Predis', |
|
350 | + 'Redis', |
|
351 | + 'Riak', |
|
352 | + 'Ssdb', |
|
353 | + 'Sqlite', |
|
354 | + 'Wincache', |
|
355 | + 'Xcache', |
|
356 | + 'Zenddisk', |
|
357 | + 'Zendshm', |
|
358 | 358 | ]; |
359 | 359 | } |
360 | 360 | |
@@ -365,11 +365,11 @@ discard block |
||
365 | 365 | public static function getStaticAllDrivers(): array |
366 | 366 | { |
367 | 367 | \trigger_error(\sprintf('Method "%s" is deprecated as of the V7 and will be removed soon or later, use CacheManager::getDriverList() instead.', |
368 | - __METHOD__), E_USER_DEPRECATED); |
|
368 | + __METHOD__), E_USER_DEPRECATED); |
|
369 | 369 | return \array_merge(self::getStaticSystemDrivers(), [ |
370 | - 'Devtrue', |
|
371 | - 'Devfalse', |
|
372 | - 'Cookie', |
|
370 | + 'Devtrue', |
|
371 | + 'Devfalse', |
|
372 | + 'Cookie', |
|
373 | 373 | ]); |
374 | 374 | } |
375 | 375 | |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | |
449 | 449 | if (!\class_exists($className)) { |
450 | 450 | throw new PhpfastcacheInvalidArgumentException( |
451 | - \sprintf("Can't add '%s' because the class '%s' does not exists", $driverName, $className) |
|
451 | + \sprintf("Can't add '%s' because the class '%s' does not exists", $driverName, $className) |
|
452 | 452 | ); |
453 | 453 | } |
454 | 454 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | |
503 | 503 | if (!\class_exists($className)) { |
504 | 504 | throw new PhpfastcacheInvalidArgumentException( |
505 | - \sprintf("Can't override '%s' because the class '%s' does not exists", $driverName, $className) |
|
505 | + \sprintf("Can't override '%s' because the class '%s' does not exists", $driverName, $className) |
|
506 | 506 | ); |
507 | 507 | } |
508 | 508 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | |
517 | 517 | if (!\is_subclass_of($className, self::CORE_DRIVER_NAMESPACE . $driverName . '\\Driver', true)) { |
518 | 518 | throw new PhpfastcacheLogicException( |
519 | - \sprintf("Can't override '%s' because the class '%s' MUST extend '%s'", $driverName, $className, |
|
519 | + \sprintf("Can't override '%s' because the class '%s' MUST extend '%s'", $driverName, $className, |
|
520 | 520 | self::CORE_DRIVER_NAMESPACE . $driverName . '\\Driver') |
521 | 521 | ); |
522 | 522 | } |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | |
133 | 133 | $instance = $instanceId ?: \md5($driver . \serialize($config->toArray())); |
134 | 134 | |
135 | - if (!isset(self::$instances[ $instance ])) { |
|
136 | - self::$badPracticeOmeter[ $driver ] = 1; |
|
135 | + if (!isset(self::$instances[$instance])) { |
|
136 | + self::$badPracticeOmeter[$driver] = 1; |
|
137 | 137 | $driverClass = self::getDriverClass($driver); |
138 | 138 | |
139 | 139 | if (!is_a($driverClass, ExtendedCacheItemPoolInterface::class, true)) { |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | try { |
147 | 147 | if (\class_exists($driverClass)) { |
148 | 148 | $configClass = $driverClass::getConfigClass(); |
149 | - self::$instances[ $instance ] = new $driverClass(new $configClass($config->toArray()), $instance); |
|
150 | - self::$instances[ $instance ]->setEventManager(EventManager::getInstance()); |
|
149 | + self::$instances[$instance] = new $driverClass(new $configClass($config->toArray()), $instance); |
|
150 | + self::$instances[$instance]->setEventManager(EventManager::getInstance()); |
|
151 | 151 | } else { |
152 | 152 | throw new PhpfastcacheDriverNotFoundException(\sprintf('The driver "%s" does not exists', $driver)); |
153 | 153 | } |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | throw new PhpfastcacheDriverCheckException($e->getMessage(), $e->getCode(), $e); |
167 | 167 | } |
168 | 168 | } |
169 | - } else if (self::$badPracticeOmeter[ $driver ] >= 2) { |
|
169 | + } else if (self::$badPracticeOmeter[$driver] >= 2) { |
|
170 | 170 | \trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances. |
171 | 171 | See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F'); |
172 | 172 | } |
173 | 173 | |
174 | - self::$badPracticeOmeter[ $driver ]++; |
|
174 | + self::$badPracticeOmeter[$driver]++; |
|
175 | 175 | |
176 | - return self::$instances[ $instance ]; |
|
176 | + return self::$instances[$instance]; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | throw new PhpfastcacheInvalidArgumentException('The Instance ID must be a string'); |
191 | 191 | } |
192 | 192 | |
193 | - if (isset(self::$instances[ $instanceId ])) { |
|
194 | - return self::$instances[ $instanceId ]; |
|
193 | + if (isset(self::$instances[$instanceId])) { |
|
194 | + return self::$instances[$instanceId]; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | throw new PhpfastcacheInstanceNotFoundException(\sprintf('Instance ID %s not found', $instanceId)); |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | throw new PhpfastcacheLogicException('Unable to find out a valid driver automatically'); |
256 | 256 | } |
257 | 257 | |
258 | - self::$badPracticeOmeter[ $autoDriver ]--; |
|
258 | + self::$badPracticeOmeter[$autoDriver]--; |
|
259 | 259 | |
260 | 260 | return $autoDriver; |
261 | 261 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public static function __callStatic(string $name, array $arguments): ExtendedCacheItemPoolInterface |
269 | 269 | { |
270 | - $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[ 0 ] : []); |
|
270 | + $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[0] : []); |
|
271 | 271 | |
272 | 272 | return self::getInstance($name, $options); |
273 | 273 | } |
@@ -397,9 +397,9 @@ discard block |
||
397 | 397 | |
398 | 398 | $driverList = \array_merge($driverList, \array_keys(self::$driverCustoms)); |
399 | 399 | |
400 | - if($FQCNAsKey){ |
|
400 | + if ($FQCNAsKey) { |
|
401 | 401 | $realDriverList = []; |
402 | - foreach ($driverList as $driverName){ |
|
402 | + foreach ($driverList as $driverName) { |
|
403 | 403 | $realDriverList[self::getDriverClass($driverName)] = $driverName; |
404 | 404 | } |
405 | 405 | $driverList = $realDriverList; |
@@ -428,10 +428,10 @@ discard block |
||
428 | 428 | */ |
429 | 429 | public static function getDriverClass(string $driverName): string |
430 | 430 | { |
431 | - if (!empty(self::$driverCustoms[ $driverName ])) { |
|
432 | - $driverClass = self::$driverCustoms[ $driverName ]; |
|
433 | - } else if (!empty(self::$driverOverrides[ $driverName ])) { |
|
434 | - $driverClass = self::$driverOverrides[ $driverName ]; |
|
431 | + if (!empty(self::$driverCustoms[$driverName])) { |
|
432 | + $driverClass = self::$driverCustoms[$driverName]; |
|
433 | + } else if (!empty(self::$driverOverrides[$driverName])) { |
|
434 | + $driverClass = self::$driverOverrides[$driverName]; |
|
435 | 435 | } else { |
436 | 436 | $driverClass = self::getNamespacePath() . $driverName . '\Driver'; |
437 | 437 | } |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | ); |
462 | 462 | } |
463 | 463 | |
464 | - if (!empty(self::$driverCustoms[ $driverName ])) { |
|
464 | + if (!empty(self::$driverCustoms[$driverName])) { |
|
465 | 465 | throw new PhpfastcacheLogicException(\sprintf("Driver '%s' has been already added", $driverName)); |
466 | 466 | } |
467 | 467 | |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | throw new PhpfastcacheLogicException(\sprintf("Driver '%s' is already a part of the PhpFastCache core", $driverName)); |
470 | 470 | } |
471 | 471 | |
472 | - self::$driverCustoms[ $driverName ] = $className; |
|
472 | + self::$driverCustoms[$driverName] = $className; |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | /** |
@@ -486,11 +486,11 @@ discard block |
||
486 | 486 | throw new PhpfastcacheInvalidArgumentException("Can't remove a custom driver because its name is empty"); |
487 | 487 | } |
488 | 488 | |
489 | - if (!isset(self::$driverCustoms[ $driverName ])) { |
|
489 | + if (!isset(self::$driverCustoms[$driverName])) { |
|
490 | 490 | throw new PhpfastcacheLogicException(\sprintf("Driver '%s' does not exists", $driverName)); |
491 | 491 | } |
492 | 492 | |
493 | - unset(self::$driverCustoms[ $driverName ]); |
|
493 | + unset(self::$driverCustoms[$driverName]); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | /** |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | ); |
516 | 516 | } |
517 | 517 | |
518 | - if (!empty(self::$driverOverrides[ $driverName ])) { |
|
518 | + if (!empty(self::$driverOverrides[$driverName])) { |
|
519 | 519 | throw new PhpfastcacheLogicException(\sprintf("Driver '%s' has been already overridden", $driverName)); |
520 | 520 | } |
521 | 521 | |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | ); |
531 | 531 | } |
532 | 532 | |
533 | - self::$driverOverrides[ $driverName ] = $className; |
|
533 | + self::$driverOverrides[$driverName] = $className; |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | /** |
@@ -547,10 +547,10 @@ discard block |
||
547 | 547 | throw new PhpfastcacheInvalidArgumentException("Can't remove a core driver override because its name is empty"); |
548 | 548 | } |
549 | 549 | |
550 | - if (!isset(self::$driverOverrides[ $driverName ])) { |
|
550 | + if (!isset(self::$driverOverrides[$driverName])) { |
|
551 | 551 | throw new PhpfastcacheLogicException(\sprintf("Driver '%s' were not overridden", $driverName)); |
552 | 552 | } |
553 | 553 | |
554 | - unset(self::$driverOverrides[ $driverName ]); |
|
554 | + unset(self::$driverOverrides[$driverName]); |
|
555 | 555 | } |
556 | 556 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | use Phpfastcache\Core\Item\ExtendedCacheItemInterface; |
20 | 20 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - PhpfastcacheDriverCheckException, PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException, PhpfastcacheRootException, PhpfastcacheSimpleCacheException |
|
22 | + PhpfastcacheDriverCheckException, PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException, PhpfastcacheRootException, PhpfastcacheSimpleCacheException |
|
23 | 23 | }; |
24 | 24 | use Psr\SimpleCache\CacheInterface; |
25 | 25 | |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | { |
85 | 85 | try { |
86 | 86 | $cacheItem = $this->internalCacheInstance |
87 | - ->getItem($key) |
|
88 | - ->set($value); |
|
87 | + ->getItem($key) |
|
88 | + ->set($value); |
|
89 | 89 | if (\is_int($ttl) && $ttl <= 0) { |
90 | 90 | $cacheItem->expiresAt((new \DateTime('@0'))); |
91 | 91 | } elseif (\is_int($ttl) || $ttl instanceof \DateInterval) { |
@@ -48,7 +48,7 @@ |
||
48 | 48 | throw new PhpfastcacheLogicException("You can't pass a config parameter along with an non-string '\$driver' parameter."); |
49 | 49 | } |
50 | 50 | $this->internalCacheInstance = $driver; |
51 | - }else{ |
|
51 | + } else{ |
|
52 | 52 | $this->internalCacheInstance = CacheManager::getInstance($driver, $config); |
53 | 53 | } |
54 | 54 | } |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct($driver, $config = null) |
45 | 45 | { |
46 | - if($driver instanceof ExtendedCacheItemPoolInterface){ |
|
47 | - if($config !== null){ |
|
46 | + if ($driver instanceof ExtendedCacheItemPoolInterface) { |
|
47 | + if ($config !== null) { |
|
48 | 48 | throw new PhpfastcacheLogicException("You can't pass a config parameter along with an non-string '\$driver' parameter."); |
49 | 49 | } |
50 | 50 | $this->internalCacheInstance = $driver; |
51 | - }else{ |
|
51 | + } else { |
|
52 | 52 | $this->internalCacheInstance = CacheManager::getInstance($driver, $config); |
53 | 53 | } |
54 | 54 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | public function getMultiple($keys, $default = null) |
134 | 134 | { |
135 | 135 | try { |
136 | - return array_map(function (ExtendedCacheItemInterface $item) { |
|
136 | + return array_map(function(ExtendedCacheItemInterface $item) { |
|
137 | 137 | return $item->get(); |
138 | 138 | }, $this->internalCacheInstance->getItems($keys)); |
139 | 139 | } catch (PhpfastcacheInvalidArgumentException $e) { |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * due to performance issue on huge |
79 | 79 | * loop dispatching operations |
80 | 80 | */ |
81 | - if (isset($this->events[ $eventName ])) { |
|
82 | - foreach ($this->events[ $eventName ] as $event) { |
|
81 | + if (isset($this->events[$eventName])) { |
|
82 | + foreach ($this->events[$eventName] as $event) { |
|
83 | 83 | \call_user_func_array($event, $args); |
84 | 84 | } |
85 | 85 | } |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | { |
96 | 96 | if (\strpos($name, 'on') === 0) { |
97 | 97 | $name = \substr($name, 2); |
98 | - if (\is_callable($arguments[ 0 ])) { |
|
99 | - if (isset($arguments[ 1 ]) && \is_string($arguments[ 0 ])) { |
|
100 | - $this->events[ $name ][ $arguments[ 1 ] ] = $arguments[ 0 ]; |
|
98 | + if (\is_callable($arguments[0])) { |
|
99 | + if (isset($arguments[1]) && \is_string($arguments[0])) { |
|
100 | + $this->events[$name][$arguments[1]] = $arguments[0]; |
|
101 | 101 | } else { |
102 | - $this->events[ $name ][] = $arguments[ 0 ]; |
|
102 | + $this->events[$name][] = $arguments[0]; |
|
103 | 103 | } |
104 | 104 | } else { |
105 | - throw new PhpfastcacheInvalidArgumentException(\sprintf('Expected Callable, got "%s"', \gettype($arguments[ 0 ]))); |
|
105 | + throw new PhpfastcacheInvalidArgumentException(\sprintf('Expected Callable, got "%s"', \gettype($arguments[0]))); |
|
106 | 106 | } |
107 | 107 | } else { |
108 | 108 | throw new \BadMethodCallException('An event must start with "on" such as "onCacheGetItem"'); |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function unbindEventCallback(string $eventName, string $callbackName): bool |
118 | 118 | { |
119 | - $return = isset($this->events[ $eventName ][ $callbackName ]); |
|
120 | - unset($this->events[ $eventName ][ $callbackName ]); |
|
119 | + $return = isset($this->events[$eventName][$callbackName]); |
|
120 | + unset($this->events[$eventName][$callbackName]); |
|
121 | 121 | |
122 | 122 | return $return; |
123 | 123 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | public function __construct($message = "", $code = 0, $previous = null) |
28 | 28 | { |
29 | 29 | $lastError = error_get_last(); |
30 | - if($lastError){ |
|
30 | + if ($lastError) { |
|
31 | 31 | $message .= "\n"; |
32 | 32 | $message .= "Additional information provided by error_get_last():\n"; |
33 | 33 | $message .= "{$lastError['message']} in {$lastError['file']} line {$lastError['line']}"; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | $map = []; |
57 | 57 | |
58 | - if(\is_array($dir) || $dir instanceof \Traversable){ |
|
58 | + if (\is_array($dir) || $dir instanceof \Traversable) { |
|
59 | 59 | foreach ($dir as $file) { |
60 | 60 | if (!$file->isFile()) { |
61 | 61 | continue; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | \gc_mem_caches(); |
71 | 71 | } |
72 | 72 | foreach ($classes as $class) { |
73 | - $map[ $class ] = $path; |
|
73 | + $map[$class] = $path; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } |
@@ -94,19 +94,19 @@ discard block |
||
94 | 94 | $tokens = \token_get_all($contents); |
95 | 95 | $classes = []; |
96 | 96 | $namespace = ''; |
97 | - for ($i = 0; isset($tokens[ $i ]); ++$i) { |
|
98 | - $token = $tokens[ $i ]; |
|
99 | - if (!isset($token[ 1 ])) { |
|
97 | + for ($i = 0; isset($tokens[$i]); ++$i) { |
|
98 | + $token = $tokens[$i]; |
|
99 | + if (!isset($token[1])) { |
|
100 | 100 | continue; |
101 | 101 | } |
102 | 102 | $class = ''; |
103 | - switch ($token[ 0 ]) { |
|
103 | + switch ($token[0]) { |
|
104 | 104 | case \T_NAMESPACE: |
105 | 105 | $namespace = ''; |
106 | 106 | // If there is a namespace, extract it |
107 | - while (isset($tokens[ ++$i ][ 1 ])) { |
|
108 | - if (\in_array($tokens[ $i ][ 0 ], [\T_STRING, \T_NS_SEPARATOR])) { |
|
109 | - $namespace .= $tokens[ $i ][ 1 ]; |
|
107 | + while (isset($tokens[ ++$i][1])) { |
|
108 | + if (\in_array($tokens[$i][0], [\T_STRING, \T_NS_SEPARATOR])) { |
|
109 | + $namespace .= $tokens[$i][1]; |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | $namespace .= '\\'; |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | // Skip usage of ::class constant |
118 | 118 | $isClassConstant = false; |
119 | 119 | for ($j = $i - 1; $j > 0; --$j) { |
120 | - if (!isset($tokens[ $j ][ 1 ])) { |
|
120 | + if (!isset($tokens[$j][1])) { |
|
121 | 121 | break; |
122 | 122 | } |
123 | - if (\T_DOUBLE_COLON === $tokens[ $j ][ 0 ]) { |
|
123 | + if (\T_DOUBLE_COLON === $tokens[$j][0]) { |
|
124 | 124 | $isClassConstant = true; |
125 | 125 | break; |
126 | - } elseif (!\in_array($tokens[ $j ][ 0 ], [\T_WHITESPACE, \T_DOC_COMMENT, \T_COMMENT], false)) { |
|
126 | + } elseif (!\in_array($tokens[$j][0], [\T_WHITESPACE, \T_DOC_COMMENT, \T_COMMENT], false)) { |
|
127 | 127 | break; |
128 | 128 | } |
129 | 129 | } |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | break; |
132 | 132 | } |
133 | 133 | // Find the classname |
134 | - while (isset($tokens[ ++$i ][ 1 ])) { |
|
135 | - $t = $tokens[ $i ]; |
|
136 | - if (\T_STRING === $t[ 0 ]) { |
|
137 | - $class .= $t[ 1 ]; |
|
138 | - } elseif ('' !== $class && \T_WHITESPACE === $t[ 0 ]) { |
|
134 | + while (isset($tokens[ ++$i][1])) { |
|
135 | + $t = $tokens[$i]; |
|
136 | + if (\T_STRING === $t[0]) { |
|
137 | + $class .= $t[1]; |
|
138 | + } elseif ('' !== $class && \T_WHITESPACE === $t[0]) { |
|
139 | 139 | break; |
140 | 140 | } |
141 | 141 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function __construct(...$args) |
34 | 34 | { |
35 | - $this->array = (\count($args) === 1 && \is_array($args[ 0 ]) ? $args[ 0 ] : $args); |
|
35 | + $this->array = (\count($args) === 1 && \is_array($args[0]) ? $args[0] : $args); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function current() |
42 | 42 | { |
43 | - return $this->array[ $this->position ]; |
|
43 | + return $this->array[$this->position]; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function offsetGet($offset) |
100 | 100 | { |
101 | - return $this->array[ $offset ] ?? null; |
|
101 | + return $this->array[$offset] ?? null; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | if ($offset === null) { |
114 | 114 | $this->array[] = $value; |
115 | 115 | } else { |
116 | - $this->array[ $offset ] = $value; |
|
116 | + $this->array[$offset] = $value; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function offsetUnset($offset) |
124 | 124 | { |
125 | - unset($this->array[ $offset ]); |
|
125 | + unset($this->array[$offset]); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -18,7 +18,7 @@ |
||
18 | 18 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
19 | 19 | use Phpfastcache\Event\EventInterface; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException, PhpfastcacheLogicException |
|
21 | + PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException, PhpfastcacheLogicException |
|
22 | 22 | }; |
23 | 23 | |
24 | 24 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $this->driver = $driver; |
71 | 71 | $this->driver->setItem($this); |
72 | 72 | $this->expirationDate = new \DateTime(); |
73 | - if($this->driver->getConfig()->isItemDetailedDate()){ |
|
73 | + if ($this->driver->getConfig()->isItemDetailedDate()) { |
|
74 | 74 | $this->creationDate = new \DateTime(); |
75 | 75 | $this->modificationDate = new \DateTime(); |
76 | 76 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | { |
225 | 225 | case 'array': |
226 | 226 | case 'object': |
227 | - if(\is_array($this->data) || $this->data instanceof \Countable){ |
|
227 | + if (\is_array($this->data) || $this->data instanceof \Countable) { |
|
228 | 228 | return \count($this->data); |
229 | 229 | } |
230 | 230 | break; |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | if (\is_array($this->data)) { |
283 | 283 | $this->data[] = $data; |
284 | 284 | } else if (\is_string($data)) { |
285 | - $this->data .= (string)$data; |
|
285 | + $this->data .= (string) $data; |
|
286 | 286 | } else { |
287 | 287 | throw new PhpfastcacheInvalidArgumentException('$data must be either array nor string.'); |
288 | 288 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | if (\is_array($this->data)) { |
302 | 302 | \array_unshift($this->data, $data); |
303 | 303 | } else if (\is_string($data)) { |
304 | - $this->data = (string)$data . $this->data; |
|
304 | + $this->data = (string) $data . $this->data; |
|
305 | 305 | } else { |
306 | 306 | throw new PhpfastcacheInvalidArgumentException('$data must be either array nor string.'); |
307 | 307 | } |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | public function removeTag($tagName): ExtendedCacheItemInterface |
381 | 381 | { |
382 | 382 | if (($key = \array_search($tagName, $this->tags)) !== false) { |
383 | - unset($this->tags[ $key ]); |
|
383 | + unset($this->tags[$key]); |
|
384 | 384 | $this->removedTags[] = $tagName; |
385 | 385 | } |
386 | 386 | |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | final public function __debugInfo() |
460 | 460 | { |
461 | 461 | $info = \get_object_vars($this); |
462 | - $info[ 'driver' ] = 'object(' . \get_class($info[ 'driver' ]) . ')'; |
|
462 | + $info['driver'] = 'object(' . \get_class($info['driver']) . ')'; |
|
463 | 463 | |
464 | 464 | return $info; |
465 | 465 | } |