@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | if(array_diff_key($array, get_object_vars($this))){ |
| 102 | 102 | throw new PhpfastcacheInvalidConfigurationException(sprintf( |
| 103 | - 'Invalid option(s) for the config %s: %s', |
|
| 104 | - static::class, |
|
| 105 | - implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
| 103 | + 'Invalid option(s) for the config %s: %s', |
|
| 104 | + static::class, |
|
| 105 | + implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
| 106 | 106 | )); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | $typeHintExpected = ($parameter instanceof \ReflectionParameter ? ($parameter->getType() === 'object' ? $parameter->getClass() : $parameter->getType()) : 'Unknown type'); |
| 135 | 135 | |
| 136 | 136 | throw new PhpfastcacheInvalidConfigurationException(sprintf( |
| 137 | - 'Invalid type hint found for "%s", expected "%s" got "%s"', |
|
| 138 | - lcfirst(substr($method, 3)), |
|
| 139 | - $typeHintExpected, |
|
| 140 | - $typeHintGot |
|
| 137 | + 'Invalid type hint found for "%s", expected "%s" got "%s"', |
|
| 138 | + lcfirst(substr($method, 3)), |
|
| 139 | + $typeHintExpected, |
|
| 140 | + $typeHintGot |
|
| 141 | 141 | )); |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -326,9 +326,9 @@ discard block |
||
| 326 | 326 | { |
| 327 | 327 | if($fallbackConfig !== null && !($fallbackConfig instanceof self)){ |
| 328 | 328 | throw new PhpfastcacheInvalidArgumentException(sprintf( |
| 329 | - 'Invalid argument "%s" for %s', |
|
| 330 | - gettype($fallbackConfig) === 'object' ? get_class($fallbackConfig) : gettype($fallbackConfig), |
|
| 331 | - __METHOD__ |
|
| 329 | + 'Invalid argument "%s" for %s', |
|
| 330 | + gettype($fallbackConfig) === 'object' ? get_class($fallbackConfig) : gettype($fallbackConfig), |
|
| 331 | + __METHOD__ |
|
| 332 | 332 | )); |
| 333 | 333 | } |
| 334 | 334 | $this->fallbackConfig = $fallbackConfig; |
@@ -427,10 +427,10 @@ discard block |
||
| 427 | 427 | * by opening a pull request :) |
| 428 | 428 | */ |
| 429 | 429 | static $safeFileExtensions = [ |
| 430 | - 'txt', |
|
| 431 | - 'cache', |
|
| 432 | - 'db', |
|
| 433 | - 'pfc', |
|
| 430 | + 'txt', |
|
| 431 | + 'cache', |
|
| 432 | + 'db', |
|
| 433 | + 'pfc', |
|
| 434 | 434 | ]; |
| 435 | 435 | |
| 436 | 436 | if (\strpos($cacheFileExtension, '.') !== false) { |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | } |
| 439 | 439 | if (!\in_array($cacheFileExtension, $safeFileExtensions, true)) { |
| 440 | 440 | throw new PhpfastcacheInvalidConfigurationException( |
| 441 | - "{$cacheFileExtension} is not a safe extension, currently allowed extension: " . \implode(', ', $safeFileExtensions) |
|
| 441 | + "{$cacheFileExtension} is not a safe extension, currently allowed extension: " . \implode(', ', $safeFileExtensions) |
|
| 442 | 442 | ); |
| 443 | 443 | } |
| 444 | 444 | |
@@ -92,33 +92,33 @@ discard block |
||
| 92 | 92 | public function __construct(...$args) |
| 93 | 93 | { |
| 94 | 94 | parent::__construct(...$args); |
| 95 | - $array =& $this->getArray(); |
|
| 95 | + $array = & $this->getArray(); |
|
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * Detect unwanted keys and throw an exception. |
| 99 | 99 | * No more kidding now, it's 21th century. |
| 100 | 100 | */ |
| 101 | - if(array_diff_key($array, get_object_vars($this))){ |
|
| 101 | + if (array_diff_key($array, get_object_vars($this))) { |
|
| 102 | 102 | throw new PhpfastcacheInvalidConfigurationException(sprintf( |
| 103 | 103 | 'Invalid option(s) for the config %s: %s', |
| 104 | 104 | static::class, |
| 105 | - implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
| 105 | + implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
| 106 | 106 | )); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | foreach (get_object_vars($this) as $property => $value) { |
| 110 | 110 | |
| 111 | - if(array_key_exists($property, $array)){ |
|
| 112 | - $this->$property = &$array[ $property ]; |
|
| 113 | - }else{ |
|
| 114 | - $array[ $property ] = &$this->$property; |
|
| 111 | + if (array_key_exists($property, $array)) { |
|
| 112 | + $this->$property = &$array[$property]; |
|
| 113 | + } else { |
|
| 114 | + $array[$property] = &$this->$property; |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | foreach (get_class_methods($this) as $method) { |
| 119 | - if(strpos($method, 'set') === 0){ |
|
| 119 | + if (strpos($method, 'set') === 0) { |
|
| 120 | 120 | $value = null; |
| 121 | - try{ |
|
| 121 | + try { |
|
| 122 | 122 | /** |
| 123 | 123 | * We use property instead of getter |
| 124 | 124 | * because of is/get conditions and |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | $value = $this->{lcfirst(substr($method, 3))}; |
| 129 | 129 | $this->{$method}($value); |
| 130 | - }catch(\TypeError $e){ |
|
| 130 | + } catch (\TypeError $e) { |
|
| 131 | 131 | $typeHintGot = \is_object($value) ? \get_class($value) : \gettype($value); |
| 132 | 132 | $reflectionMethod = new \ReflectionMethod($this, $method); |
| 133 | 133 | $parameter = $reflectionMethod->getParameters()[0] ?? null; |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | */ |
| 325 | 325 | public function setFallbackConfig($fallbackConfig): self |
| 326 | 326 | { |
| 327 | - if($fallbackConfig !== null && !($fallbackConfig instanceof self)){ |
|
| 327 | + if ($fallbackConfig !== null && !($fallbackConfig instanceof self)) { |
|
| 328 | 328 | throw new PhpfastcacheInvalidArgumentException(sprintf( |
| 329 | 329 | 'Invalid argument "%s" for %s', |
| 330 | 330 | gettype($fallbackConfig) === 'object' ? get_class($fallbackConfig) : gettype($fallbackConfig), |
@@ -212,11 +212,11 @@ discard block |
||
| 212 | 212 | $this->printSkipText('A driver could not be initialized due to missing requirement: ' . $exception->getMessage()); |
| 213 | 213 | } else { |
| 214 | 214 | $this->printFailText(sprintf( |
| 215 | - 'Uncaught exception "%s" in "%s" line %d with message: "%s"', |
|
| 216 | - \get_class($exception), |
|
| 217 | - $exception->getFile(), |
|
| 218 | - $exception->getLine(), |
|
| 219 | - $exception->getMessage() |
|
| 215 | + 'Uncaught exception "%s" in "%s" line %d with message: "%s"', |
|
| 216 | + \get_class($exception), |
|
| 217 | + $exception->getFile(), |
|
| 218 | + $exception->getLine(), |
|
| 219 | + $exception->getMessage() |
|
| 220 | 220 | )); |
| 221 | 221 | } |
| 222 | 222 | $this->terminateTest(); |
@@ -263,17 +263,17 @@ discard block |
||
| 263 | 263 | |
| 264 | 264 | if ($errorType === '[FATAL ERROR]') { |
| 265 | 265 | $this->printFailText(sprintf( |
| 266 | - "A critical error has been caught: \"%s\" in %s line %d", |
|
| 267 | - "$errorType $errstr", |
|
| 268 | - $errfile, |
|
| 269 | - $errline |
|
| 266 | + "A critical error has been caught: \"%s\" in %s line %d", |
|
| 267 | + "$errorType $errstr", |
|
| 268 | + $errfile, |
|
| 269 | + $errline |
|
| 270 | 270 | )); |
| 271 | 271 | } else { |
| 272 | 272 | $this->printDebugText(sprintf( |
| 273 | - "A non-critical error has been caught: \"%s\" in %s line %d", |
|
| 274 | - "$errorType $errstr", |
|
| 275 | - $errfile, |
|
| 276 | - $errline |
|
| 273 | + "A non-critical error has been caught: \"%s\" in %s line %d", |
|
| 274 | + "$errorType $errstr", |
|
| 275 | + $errfile, |
|
| 276 | + $errline |
|
| 277 | 277 | )); |
| 278 | 278 | } |
| 279 | 279 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | -declare(strict_types=1); |
|
| 14 | +declare(strict_types = 1); |
|
| 15 | 15 | |
| 16 | 16 | namespace Phpfastcache\Helper; |
| 17 | 17 | |