@@ -14,4 +14,4 @@ |
||
14 | 14 | * @package phpFastCache\Config |
15 | 15 | * @see ConfigurationOption |
16 | 16 | */ |
17 | -class Config extends ConfigurationOption{} |
|
18 | 17 | \ No newline at end of file |
18 | +class Config extends ConfigurationOption {} |
|
19 | 19 | \ No newline at end of file |
@@ -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; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function setIgnoreSymfonyNotice(bool $ignoreSymfonyNotice): self |
218 | 218 | { |
219 | - if($ignoreSymfonyNotice){ |
|
219 | + if ($ignoreSymfonyNotice) { |
|
220 | 220 | \trigger_error('Configuration option "ignoreSymfonyNotice" is deprecated as of the V7', E_USER_DEPRECATED); |
221 | 221 | } |
222 | 222 | $this->ignoreSymfonyNotice = $ignoreSymfonyNotice; |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | */ |
332 | 332 | public function setFallbackConfig($fallbackConfig): self |
333 | 333 | { |
334 | - if($fallbackConfig !== null && !($fallbackConfig instanceof self)){ |
|
334 | + if ($fallbackConfig !== null && !($fallbackConfig instanceof self)) { |
|
335 | 335 | throw new PhpfastcacheInvalidArgumentException(\sprintf( |
336 | 336 | 'Invalid argument "%s" for %s', |
337 | 337 | gettype($fallbackConfig) === 'object' ? get_class($fallbackConfig) : gettype($fallbackConfig), |
@@ -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 | } |
@@ -64,29 +64,29 @@ discard block |
||
64 | 64 | */ |
65 | 65 | static $version; |
66 | 66 | |
67 | - if($version && $cacheable){ |
|
67 | + if ($version && $cacheable) { |
|
68 | 68 | return $version; |
69 | 69 | } |
70 | 70 | |
71 | - if(\function_exists('shell_exec')){ |
|
71 | + if (\function_exists('shell_exec')) { |
|
72 | 72 | $stdout = shell_exec('git describe --abbrev=0 --tags'); |
73 | - if(\is_string($stdout)){ |
|
73 | + if (\is_string($stdout)) { |
|
74 | 74 | $version = \trim($stdout); |
75 | 75 | return $version; |
76 | 76 | } |
77 | 77 | throw new PhpfastcacheLogicException('The git command used to retrieve the PhpFastCache version has failed.'); |
78 | 78 | } |
79 | 79 | |
80 | - if(!$fallbackOnChangelog){ |
|
80 | + if (!$fallbackOnChangelog) { |
|
81 | 81 | throw new PhpfastcacheLogicException('shell_exec is disabled therefore the PhpFastCache version cannot be retrieved.'); |
82 | 82 | } |
83 | 83 | |
84 | 84 | $changelogFilename = __DIR__ . '/../../CHANGELOG.md'; |
85 | - if(\file_exists($changelogFilename)){ |
|
85 | + if (\file_exists($changelogFilename)) { |
|
86 | 86 | $versionPrefix = '## '; |
87 | 87 | $changelog = \explode("\n", self::getPhpFastCacheChangelog()); |
88 | - foreach ($changelog as $line){ |
|
89 | - if(\strpos($line, $versionPrefix) === 0){ |
|
88 | + foreach ($changelog as $line) { |
|
89 | + if (\strpos($line, $versionPrefix) === 0) { |
|
90 | 90 | $version = \trim(\str_replace($versionPrefix, '', $line)); |
91 | 91 | return $version; |
92 | 92 | } |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | { |
105 | 105 | static $hash; |
106 | 106 | |
107 | - if($hash && $cacheable){ |
|
107 | + if ($hash && $cacheable) { |
|
108 | 108 | return $hash; |
109 | 109 | } |
110 | 110 | |
111 | - if(\function_exists('shell_exec')){ |
|
111 | + if (\function_exists('shell_exec')) { |
|
112 | 112 | $stdout = \shell_exec('git rev-parse --short HEAD'); |
113 | - if(\is_string($stdout)){ |
|
113 | + if (\is_string($stdout)) { |
|
114 | 114 | $hash = \trim($stdout); |
115 | 115 | return "#{$hash}"; |
116 | 116 | } |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | public static function getChangelog(): string |
129 | 129 | { |
130 | 130 | $changelogFilename = __DIR__ . '/../../CHANGELOG_API.md'; |
131 | - if(\file_exists($changelogFilename)){ |
|
131 | + if (\file_exists($changelogFilename)) { |
|
132 | 132 | $string = \str_replace(["\r\n", "\r"], "\n", \trim(\file_get_contents($changelogFilename))); |
133 | - if($string){ |
|
133 | + if ($string) { |
|
134 | 134 | return $string; |
135 | 135 | } |
136 | 136 | throw new PhpfastcacheLogicException('Unable to retrieve the PhpFastCache API changelog as it seems to be empty.'); |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | public static function getPhpFastCacheChangelog(): string |
148 | 148 | { |
149 | 149 | $changelogFilename = __DIR__ . '/../../CHANGELOG.md'; |
150 | - if(\file_exists($changelogFilename)){ |
|
150 | + if (\file_exists($changelogFilename)) { |
|
151 | 151 | $string = \str_replace(["\r\n", "\r"], "\n", \trim(\file_get_contents($changelogFilename))); |
152 | - if($string){ |
|
152 | + if ($string) { |
|
153 | 153 | return $string; |
154 | 154 | } |
155 | 155 | throw new PhpfastcacheLogicException('Unable to retrieve the PhpFastCache changelog as it seems to be empty.'); |
@@ -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']}"; |
@@ -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 | } |
@@ -419,10 +419,10 @@ discard block |
||
419 | 419 | */ |
420 | 420 | public static function getDriverClass(string $driverName): string |
421 | 421 | { |
422 | - if (!empty(self::$driverCustoms[ $driverName ])) { |
|
423 | - $driverClass = self::$driverCustoms[ $driverName ]; |
|
424 | - } else if (!empty(self::$driverOverrides[ $driverName ])) { |
|
425 | - $driverClass = self::$driverOverrides[ $driverName ]; |
|
422 | + if (!empty(self::$driverCustoms[$driverName])) { |
|
423 | + $driverClass = self::$driverCustoms[$driverName]; |
|
424 | + } else if (!empty(self::$driverOverrides[$driverName])) { |
|
425 | + $driverClass = self::$driverOverrides[$driverName]; |
|
426 | 426 | } else { |
427 | 427 | $driverClass = self::getNamespacePath() . $driverName . '\Driver'; |
428 | 428 | } |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | ); |
453 | 453 | } |
454 | 454 | |
455 | - if (!empty(self::$driverCustoms[ $driverName ])) { |
|
455 | + if (!empty(self::$driverCustoms[$driverName])) { |
|
456 | 456 | throw new PhpfastcacheLogicException(\sprintf("Driver '%s' has been already added", $driverName)); |
457 | 457 | } |
458 | 458 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | throw new PhpfastcacheLogicException(\sprintf("Driver '%s' is already a part of the PhpFastCache core", $driverName)); |
461 | 461 | } |
462 | 462 | |
463 | - self::$driverCustoms[ $driverName ] = $className; |
|
463 | + self::$driverCustoms[$driverName] = $className; |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | /** |
@@ -477,11 +477,11 @@ discard block |
||
477 | 477 | throw new PhpfastcacheInvalidArgumentException("Can't remove a custom driver because its name is empty"); |
478 | 478 | } |
479 | 479 | |
480 | - if (!isset(self::$driverCustoms[ $driverName ])) { |
|
480 | + if (!isset(self::$driverCustoms[$driverName])) { |
|
481 | 481 | throw new PhpfastcacheLogicException(\sprintf("Driver '%s' does not exists", $driverName)); |
482 | 482 | } |
483 | 483 | |
484 | - unset(self::$driverCustoms[ $driverName ]); |
|
484 | + unset(self::$driverCustoms[$driverName]); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | /** |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | ); |
507 | 507 | } |
508 | 508 | |
509 | - if (!empty(self::$driverOverrides[ $driverName ])) { |
|
509 | + if (!empty(self::$driverOverrides[$driverName])) { |
|
510 | 510 | throw new PhpfastcacheLogicException(\sprintf("Driver '%s' has been already overridden", $driverName)); |
511 | 511 | } |
512 | 512 | |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | ); |
522 | 522 | } |
523 | 523 | |
524 | - self::$driverOverrides[ $driverName ] = $className; |
|
524 | + self::$driverOverrides[$driverName] = $className; |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | /** |
@@ -538,10 +538,10 @@ discard block |
||
538 | 538 | throw new PhpfastcacheInvalidArgumentException("Can't remove a core driver override because its name is empty"); |
539 | 539 | } |
540 | 540 | |
541 | - if (!isset(self::$driverOverrides[ $driverName ])) { |
|
541 | + if (!isset(self::$driverOverrides[$driverName])) { |
|
542 | 542 | throw new PhpfastcacheLogicException(\sprintf("Driver '%s' were not overridden", $driverName)); |
543 | 543 | } |
544 | 544 | |
545 | - unset(self::$driverOverrides[ $driverName ]); |
|
545 | + unset(self::$driverOverrides[$driverName]); |
|
546 | 546 | } |
547 | 547 | } |
@@ -87,8 +87,7 @@ discard block |
||
87 | 87 | return \unlink($source); |
88 | 88 | } |
89 | 89 | |
90 | - $files = new RecursiveIteratorIterator |
|
91 | - ( |
|
90 | + $files = new RecursiveIteratorIterator( |
|
92 | 91 | new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
93 | 92 | RecursiveIteratorIterator::CHILD_FIRST |
94 | 93 | ); |
@@ -138,8 +137,8 @@ discard block |
||
138 | 137 | /** |
139 | 138 | * Allows to dereference char |
140 | 139 | */ |
141 | - $__FILE__ = \preg_replace('~^(([a-z0-9\-]+)://)~', '', __FILE__);// remove file protocols such as "phar://" etc. |
|
142 | - $prefix = $__FILE__[ 0 ] === \DIRECTORY_SEPARATOR ? \DIRECTORY_SEPARATOR : ''; |
|
140 | + $__FILE__ = \preg_replace('~^(([a-z0-9\-]+)://)~', '', __FILE__); // remove file protocols such as "phar://" etc. |
|
141 | + $prefix = $__FILE__[0] === \DIRECTORY_SEPARATOR ? \DIRECTORY_SEPARATOR : ''; |
|
143 | 142 | return $prefix . \implode(\DIRECTORY_SEPARATOR, $absolutes); |
144 | 143 | } |
145 | 144 | } |
146 | 145 | \ No newline at end of file |
@@ -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 | /** |