@@ -29,13 +29,13 @@ |
||
29 | 29 | } |
30 | 30 | public function getFunctions() |
31 | 31 | { |
32 | - return [new ExpressionFunction('service', $this->serviceCompiler ?: function ($arg) { |
|
32 | + return [new ExpressionFunction('service', $this->serviceCompiler ?: function($arg) { |
|
33 | 33 | return \sprintf('$this->get(%s)', $arg); |
34 | - }, function (array $variables, $value) { |
|
34 | + }, function(array $variables, $value) { |
|
35 | 35 | return $variables['container']->get($value); |
36 | - }), new ExpressionFunction('parameter', function ($arg) { |
|
36 | + }), new ExpressionFunction('parameter', function($arg) { |
|
37 | 37 | return \sprintf('$this->getParameter(%s)', $arg); |
38 | - }, function (array $variables, $value) { |
|
38 | + }, function(array $variables, $value) { |
|
39 | 39 | return $variables['container']->getParameter($value); |
40 | 40 | })]; |
41 | 41 | } |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | public function get($name) |
62 | 62 | { |
63 | 63 | $name = $this->normalizeName($name); |
64 | - if (!\array_key_exists($name, $this->parameters)) { |
|
65 | - if (!$name) { |
|
64 | + if ( ! \array_key_exists($name, $this->parameters)) { |
|
65 | + if ( ! $name) { |
|
66 | 66 | throw new ParameterNotFoundException($name); |
67 | 67 | } |
68 | 68 | $alternatives = []; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | } |
75 | 75 | $nonNestedAlternative = null; |
76 | - if (!\count($alternatives) && \false !== \strpos($name, '.')) { |
|
76 | + if ( ! \count($alternatives) && \false !== \strpos($name, '.')) { |
|
77 | 77 | $namePartsLength = \array_map('strlen', \explode('.', $name)); |
78 | 78 | $key = \substr($name, 0, -1 * (1 + \array_pop($namePartsLength))); |
79 | 79 | while (\count($namePartsLength)) { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | } |
159 | 159 | return $args; |
160 | 160 | } |
161 | - if (!\is_string($value) || 2 > \strlen($value)) { |
|
161 | + if ( ! \is_string($value) || 2 > \strlen($value)) { |
|
162 | 162 | return $value; |
163 | 163 | } |
164 | 164 | return $this->resolveString($value, $resolving); |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | $resolving[$lcKey] = \true; |
191 | 191 | return $this->resolved ? $this->get($key) : $this->resolveValue($this->get($key), $resolving); |
192 | 192 | } |
193 | - return \preg_replace_callback('/%%|%([^%\\s]+)%/', function ($match) use($resolving, $value) { |
|
193 | + return \preg_replace_callback('/%%|%([^%\\s]+)%/', function($match) use($resolving, $value) { |
|
194 | 194 | // skip %% |
195 | - if (!isset($match[1])) { |
|
195 | + if ( ! isset($match[1])) { |
|
196 | 196 | return '%%'; |
197 | 197 | } |
198 | 198 | $key = $match[1]; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | throw new ParameterCircularReferenceException(\array_keys($resolving)); |
203 | 203 | } |
204 | 204 | $resolved = $this->get($key); |
205 | - if (!\is_string($resolved) && !\is_numeric($resolved)) { |
|
205 | + if ( ! \is_string($resolved) && ! \is_numeric($resolved)) { |
|
206 | 206 | throw new RuntimeException(\sprintf('A string value must be composed of strings and/or numbers, but found parameter "%s" of type "%s" inside string value "%s".', $key, \gettype($resolved), $value)); |
207 | 207 | } |
208 | 208 | $resolved = (string) $resolved; |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | // return first result |
33 | 33 | } |
34 | 34 | } |
35 | - if (!\preg_match('/^(?:\\w++:)*+\\w++$/', $env)) { |
|
35 | + if ( ! \preg_match('/^(?:\\w++:)*+\\w++$/', $env)) { |
|
36 | 36 | throw new InvalidArgumentException(\sprintf('Invalid "%s" name: only "word" characters are allowed.', $name)); |
37 | 37 | } |
38 | 38 | if ($this->has($name)) { |
39 | 39 | $defaultValue = parent::get($name); |
40 | - if (null !== $defaultValue && !\is_scalar($defaultValue)) { |
|
40 | + if (null !== $defaultValue && ! \is_scalar($defaultValue)) { |
|
41 | 41 | throw new RuntimeException(\sprintf('The default value of an env() parameter must be scalar or null, but "%s" given to "%s".', \gettype($defaultValue), $name)); |
42 | 42 | } |
43 | 43 | } |
44 | - $uniqueName = \md5($name . \uniqid(\mt_rand(), \true)); |
|
44 | + $uniqueName = \md5($name.\uniqid(\mt_rand(), \true)); |
|
45 | 45 | $placeholder = \sprintf('env_%s_%s', \str_replace(':', '_', $env), $uniqueName); |
46 | 46 | $this->envPlaceholders[$env][$placeholder] = $placeholder; |
47 | 47 | return $placeholder; |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | } |
96 | 96 | parent::resolve(); |
97 | 97 | foreach ($this->envPlaceholders as $env => $placeholders) { |
98 | - if (!$this->has($name = "env({$env})")) { |
|
98 | + if ( ! $this->has($name = "env({$env})")) { |
|
99 | 99 | continue; |
100 | 100 | } |
101 | 101 | if (\is_numeric($default = $this->parameters[$name])) { |
102 | 102 | $this->parameters[$name] = (string) $default; |
103 | - } elseif (null !== $default && !\is_scalar($default)) { |
|
103 | + } elseif (null !== $default && ! \is_scalar($default)) { |
|
104 | 104 | throw new RuntimeException(\sprintf('The default value of env parameter "%s" must be scalar or null, "%s" given.', $env, \gettype($default))); |
105 | 105 | } |
106 | 106 | } |
@@ -55,11 +55,11 @@ |
||
55 | 55 | if (\false === \strpos($class, '@')) { |
56 | 56 | return $class; |
57 | 57 | } |
58 | - return ((\get_parent_class($class) ?: \key(\class_implements($class))) ?: 'class') . '@anonymous'; |
|
58 | + return ((\get_parent_class($class) ?: \key(\class_implements($class))) ?: 'class').'@anonymous'; |
|
59 | 59 | } |
60 | 60 | public static function get_resource_id($res) : int |
61 | 61 | { |
62 | - if (!\is_resource($res) && null === @\get_resource_type($res)) { |
|
62 | + if ( ! \is_resource($res) && null === @\get_resource_type($res)) { |
|
63 | 63 | throw new \TypeError(\sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', \get_debug_type($res))); |
64 | 64 | } |
65 | 65 | return (int) $res; |
@@ -14,46 +14,46 @@ |
||
14 | 14 | if (\PHP_VERSION_ID >= 80000) { |
15 | 15 | return; |
16 | 16 | } |
17 | -if (!\defined('FILTER_VALIDATE_BOOL') && \defined('FILTER_VALIDATE_BOOLEAN')) { |
|
17 | +if ( ! \defined('FILTER_VALIDATE_BOOL') && \defined('FILTER_VALIDATE_BOOLEAN')) { |
|
18 | 18 | \define('FILTER_VALIDATE_BOOL', \FILTER_VALIDATE_BOOLEAN); |
19 | 19 | } |
20 | -if (!\function_exists('fdiv')) { |
|
20 | +if ( ! \function_exists('fdiv')) { |
|
21 | 21 | function fdiv(float $num1, float $num2) : float |
22 | 22 | { |
23 | 23 | return p\Php80::fdiv($num1, $num2); |
24 | 24 | } |
25 | 25 | } |
26 | -if (!\function_exists('preg_last_error_msg')) { |
|
26 | +if ( ! \function_exists('preg_last_error_msg')) { |
|
27 | 27 | function preg_last_error_msg() : string |
28 | 28 | { |
29 | 29 | return p\Php80::preg_last_error_msg(); |
30 | 30 | } |
31 | 31 | } |
32 | -if (!\function_exists('str_contains')) { |
|
32 | +if ( ! \function_exists('str_contains')) { |
|
33 | 33 | function str_contains(?string $haystack, ?string $needle) : bool |
34 | 34 | { |
35 | 35 | return p\Php80::str_contains($haystack ?? '', $needle ?? ''); |
36 | 36 | } |
37 | 37 | } |
38 | -if (!\function_exists('str_starts_with')) { |
|
38 | +if ( ! \function_exists('str_starts_with')) { |
|
39 | 39 | function str_starts_with(?string $haystack, ?string $needle) : bool |
40 | 40 | { |
41 | 41 | return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); |
42 | 42 | } |
43 | 43 | } |
44 | -if (!\function_exists('str_ends_with')) { |
|
44 | +if ( ! \function_exists('str_ends_with')) { |
|
45 | 45 | function str_ends_with(?string $haystack, ?string $needle) : bool |
46 | 46 | { |
47 | 47 | return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); |
48 | 48 | } |
49 | 49 | } |
50 | -if (!\function_exists('get_debug_type')) { |
|
50 | +if ( ! \function_exists('get_debug_type')) { |
|
51 | 51 | function get_debug_type($value) : string |
52 | 52 | { |
53 | 53 | return p\Php80::get_debug_type($value); |
54 | 54 | } |
55 | 55 | } |
56 | -if (!\function_exists('get_resource_id')) { |
|
56 | +if ( ! \function_exists('get_resource_id')) { |
|
57 | 57 | function get_resource_id($resource) : int |
58 | 58 | { |
59 | 59 | return p\Php80::get_resource_id($resource); |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | public function copy($originFile, $targetFile, $overwriteNewerFiles = \false) |
39 | 39 | { |
40 | 40 | $originIsLocal = \stream_is_local($originFile) || 0 === \stripos($originFile, 'file://'); |
41 | - if ($originIsLocal && !\is_file($originFile)) { |
|
41 | + if ($originIsLocal && ! \is_file($originFile)) { |
|
42 | 42 | throw new FileNotFoundException(\sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile); |
43 | 43 | } |
44 | 44 | $this->mkdir(\dirname($targetFile)); |
45 | 45 | $doCopy = \true; |
46 | - if (!$overwriteNewerFiles && null === \parse_url($originFile, \PHP_URL_HOST) && \is_file($targetFile)) { |
|
46 | + if ( ! $overwriteNewerFiles && null === \parse_url($originFile, \PHP_URL_HOST) && \is_file($targetFile)) { |
|
47 | 47 | $doCopy = \filemtime($originFile) > \filemtime($targetFile); |
48 | 48 | } |
49 | 49 | if ($doCopy) { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | \fclose($source); |
60 | 60 | \fclose($target); |
61 | 61 | unset($source, $target); |
62 | - if (!\is_file($targetFile)) { |
|
62 | + if ( ! \is_file($targetFile)) { |
|
63 | 63 | throw new IOException(\sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile); |
64 | 64 | } |
65 | 65 | if ($originIsLocal) { |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | if (\is_dir($dir)) { |
86 | 86 | continue; |
87 | 87 | } |
88 | - if (!self::box('mkdir', $dir, $mode, \true)) { |
|
89 | - if (!\is_dir($dir)) { |
|
88 | + if ( ! self::box('mkdir', $dir, $mode, \true)) { |
|
89 | + if ( ! \is_dir($dir)) { |
|
90 | 90 | // The directory was not created by a concurrent process. Let's throw an exception with a developer friendly error message if we have one |
91 | 91 | if (self::$lastError) { |
92 | - throw new IOException(\sprintf('Failed to create "%s": ', $dir) . self::$lastError, 0, null, $dir); |
|
92 | + throw new IOException(\sprintf('Failed to create "%s": ', $dir).self::$lastError, 0, null, $dir); |
|
93 | 93 | } |
94 | 94 | throw new IOException(\sprintf('Failed to create "%s".', $dir), 0, null, $dir); |
95 | 95 | } |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function exists($files) |
107 | 107 | { |
108 | - $maxPathLength = \PHP_MAXPATHLEN - 2; |
|
108 | + $maxPathLength = \PHP_MAXPATHLEN -2; |
|
109 | 109 | foreach ($this->toIterable($files) as $file) { |
110 | 110 | if (\strlen($file) > $maxPathLength) { |
111 | 111 | throw new IOException(\sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file); |
112 | 112 | } |
113 | - if (!\file_exists($file)) { |
|
113 | + if ( ! \file_exists($file)) { |
|
114 | 114 | return \false; |
115 | 115 | } |
116 | 116 | } |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | { |
146 | 146 | if ($files instanceof \Traversable) { |
147 | 147 | $files = \iterator_to_array($files, \false); |
148 | - } elseif (!\is_array($files)) { |
|
148 | + } elseif ( ! \is_array($files)) { |
|
149 | 149 | $files = [$files]; |
150 | 150 | } |
151 | 151 | $files = \array_reverse($files); |
152 | 152 | foreach ($files as $file) { |
153 | 153 | if (\is_link($file)) { |
154 | 154 | // See https://bugs.php.net/52176 |
155 | - if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && \file_exists($file)) { |
|
156 | - throw new IOException(\sprintf('Failed to remove symlink "%s": ', $file) . self::$lastError); |
|
155 | + if ( ! (self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && \file_exists($file)) { |
|
156 | + throw new IOException(\sprintf('Failed to remove symlink "%s": ', $file).self::$lastError); |
|
157 | 157 | } |
158 | 158 | } elseif (\is_dir($file)) { |
159 | 159 | $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS)); |
160 | - if (!self::box('rmdir', $file) && \file_exists($file)) { |
|
161 | - throw new IOException(\sprintf('Failed to remove directory "%s": ', $file) . self::$lastError); |
|
160 | + if ( ! self::box('rmdir', $file) && \file_exists($file)) { |
|
161 | + throw new IOException(\sprintf('Failed to remove directory "%s": ', $file).self::$lastError); |
|
162 | 162 | } |
163 | - } elseif (!self::box('unlink', $file) && (\str_contains(self::$lastError, 'Permission denied') || \file_exists($file))) { |
|
164 | - throw new IOException(\sprintf('Failed to remove file "%s": ', $file) . self::$lastError); |
|
163 | + } elseif ( ! self::box('unlink', $file) && (\str_contains(self::$lastError, 'Permission denied') || \file_exists($file))) { |
|
164 | + throw new IOException(\sprintf('Failed to remove file "%s": ', $file).self::$lastError); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | if ((\PHP_VERSION_ID < 80000 || \is_int($mode)) && \true !== @\chmod($file, $mode & ~$umask)) { |
182 | 182 | throw new IOException(\sprintf('Failed to chmod file "%s".', $file), 0, null, $file); |
183 | 183 | } |
184 | - if ($recursive && \is_dir($file) && !\is_link($file)) { |
|
184 | + if ($recursive && \is_dir($file) && ! \is_link($file)) { |
|
185 | 185 | $this->chmod(new \FilesystemIterator($file), $mode, $umask, \true); |
186 | 186 | } |
187 | 187 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | public function chown($files, $user, $recursive = \false) |
199 | 199 | { |
200 | 200 | foreach ($this->toIterable($files) as $file) { |
201 | - if ($recursive && \is_dir($file) && !\is_link($file)) { |
|
201 | + if ($recursive && \is_dir($file) && ! \is_link($file)) { |
|
202 | 202 | $this->chown(new \FilesystemIterator($file), $user, \true); |
203 | 203 | } |
204 | 204 | if (\is_link($file) && \function_exists('lchown')) { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | public function chgrp($files, $group, $recursive = \false) |
225 | 225 | { |
226 | 226 | foreach ($this->toIterable($files) as $file) { |
227 | - if ($recursive && \is_dir($file) && !\is_link($file)) { |
|
227 | + if ($recursive && \is_dir($file) && ! \is_link($file)) { |
|
228 | 228 | $this->chgrp(new \FilesystemIterator($file), $group, \true); |
229 | 229 | } |
230 | 230 | if (\is_link($file) && \function_exists('lchgrp')) { |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | public function rename($origin, $target, $overwrite = \false) |
252 | 252 | { |
253 | 253 | // we check that target does not exist |
254 | - if (!$overwrite && $this->isReadable($target)) { |
|
254 | + if ( ! $overwrite && $this->isReadable($target)) { |
|
255 | 255 | throw new IOException(\sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target); |
256 | 256 | } |
257 | 257 | if (\true !== @\rename($origin, $target)) { |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | */ |
272 | 272 | private function isReadable(string $filename) : bool |
273 | 273 | { |
274 | - $maxPathLength = \PHP_MAXPATHLEN - 2; |
|
274 | + $maxPathLength = \PHP_MAXPATHLEN -2; |
|
275 | 275 | if (\strlen($filename) > $maxPathLength) { |
276 | 276 | throw new IOException(\sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename); |
277 | 277 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | } |
305 | 305 | $this->remove($targetDir); |
306 | 306 | } |
307 | - if (!self::box('symlink', $originDir, $targetDir)) { |
|
307 | + if ( ! self::box('symlink', $originDir, $targetDir)) { |
|
308 | 308 | $this->linkException($originDir, $targetDir, 'symbolic'); |
309 | 309 | } |
310 | 310 | } |
@@ -320,10 +320,10 @@ discard block |
||
320 | 320 | public function hardlink($originFile, $targetFiles) |
321 | 321 | { |
322 | 322 | self::assertFunctionExists('link'); |
323 | - if (!$this->exists($originFile)) { |
|
323 | + if ( ! $this->exists($originFile)) { |
|
324 | 324 | throw new FileNotFoundException(null, 0, null, $originFile); |
325 | 325 | } |
326 | - if (!\is_file($originFile)) { |
|
326 | + if ( ! \is_file($originFile)) { |
|
327 | 327 | throw new FileNotFoundException(\sprintf('Origin file "%s" is not a file.', $originFile)); |
328 | 328 | } |
329 | 329 | foreach ($this->toIterable($targetFiles) as $targetFile) { |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | } |
334 | 334 | $this->remove($targetFile); |
335 | 335 | } |
336 | - if (!self::box('link', $originFile, $targetFile)) { |
|
336 | + if ( ! self::box('link', $originFile, $targetFile)) { |
|
337 | 337 | $this->linkException($originFile, $targetFile, 'hard'); |
338 | 338 | } |
339 | 339 | } |
@@ -368,11 +368,11 @@ discard block |
||
368 | 368 | */ |
369 | 369 | public function readlink($path, $canonicalize = \false) |
370 | 370 | { |
371 | - if (!$canonicalize && !\is_link($path)) { |
|
371 | + if ( ! $canonicalize && ! \is_link($path)) { |
|
372 | 372 | return null; |
373 | 373 | } |
374 | 374 | if ($canonicalize) { |
375 | - if (!$this->exists($path)) { |
|
375 | + if ( ! $this->exists($path)) { |
|
376 | 376 | return null; |
377 | 377 | } |
378 | 378 | if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70410) { |
@@ -395,10 +395,10 @@ discard block |
||
395 | 395 | */ |
396 | 396 | public function makePathRelative($endPath, $startPath) |
397 | 397 | { |
398 | - if (!$this->isAbsolutePath($startPath)) { |
|
398 | + if ( ! $this->isAbsolutePath($startPath)) { |
|
399 | 399 | throw new InvalidArgumentException(\sprintf('The start path "%s" is not absolute.', $startPath)); |
400 | 400 | } |
401 | - if (!$this->isAbsolutePath($endPath)) { |
|
401 | + if ( ! $this->isAbsolutePath($endPath)) { |
|
402 | 402 | throw new InvalidArgumentException(\sprintf('The end path "%s" is not absolute.', $endPath)); |
403 | 403 | } |
404 | 404 | // Normalize separators on Windows |
@@ -406,10 +406,10 @@ discard block |
||
406 | 406 | $endPath = \str_replace('\\', '/', $endPath); |
407 | 407 | $startPath = \str_replace('\\', '/', $startPath); |
408 | 408 | } |
409 | - $splitDriveLetter = function ($path) { |
|
409 | + $splitDriveLetter = function($path) { |
|
410 | 410 | return \strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && \ctype_alpha($path[0]) ? [\substr($path, 2), \strtoupper($path[0])] : [$path, null]; |
411 | 411 | }; |
412 | - $splitPath = function ($path) { |
|
412 | + $splitPath = function($path) { |
|
413 | 413 | $result = []; |
414 | 414 | foreach (\explode('/', \trim($path, '/')) as $segment) { |
415 | 415 | if ('..' === $segment) { |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | $endPathArr = $splitPath($endPath); |
427 | 427 | if ($endDriveLetter && $startDriveLetter && $endDriveLetter != $startDriveLetter) { |
428 | 428 | // End path is on another drive, so no relative path exists |
429 | - return $endDriveLetter . ':/' . ($endPathArr ? \implode('/', $endPathArr) . '/' : ''); |
|
429 | + return $endDriveLetter.':/'.($endPathArr ? \implode('/', $endPathArr).'/' : ''); |
|
430 | 430 | } |
431 | 431 | // Find for which directory the common path stops |
432 | 432 | $index = 0; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | $traverser = \str_repeat('../', $depth); |
444 | 444 | $endPathRemainder = \implode('/', \array_slice($endPathArr, $index)); |
445 | 445 | // Construct $endPath from traversing to the common path, then to the remaining $endPath |
446 | - $relativePath = $traverser . ('' !== $endPathRemainder ? $endPathRemainder . '/' : ''); |
|
446 | + $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : ''); |
|
447 | 447 | return '' === $relativePath ? './' : $relativePath; |
448 | 448 | } |
449 | 449 | /** |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | $targetDir = \rtrim($targetDir, '/\\'); |
471 | 471 | $originDir = \rtrim($originDir, '/\\'); |
472 | 472 | $originDirLen = \strlen($originDir); |
473 | - if (!$this->exists($originDir)) { |
|
473 | + if ( ! $this->exists($originDir)) { |
|
474 | 474 | throw new IOException(\sprintf('The origin directory specified "%s" was not found.', $originDir), 0, null, $originDir); |
475 | 475 | } |
476 | 476 | // Iterate in destination folder to remove obsolete entries |
@@ -482,8 +482,8 @@ discard block |
||
482 | 482 | } |
483 | 483 | $targetDirLen = \strlen($targetDir); |
484 | 484 | foreach ($deleteIterator as $file) { |
485 | - $origin = $originDir . \substr($file->getPathname(), $targetDirLen); |
|
486 | - if (!$this->exists($origin)) { |
|
485 | + $origin = $originDir.\substr($file->getPathname(), $targetDirLen); |
|
486 | + if ( ! $this->exists($origin)) { |
|
487 | 487 | $this->remove($file); |
488 | 488 | } |
489 | 489 | } |
@@ -499,9 +499,9 @@ discard block |
||
499 | 499 | if ($file->getPathname() === $targetDir || $file->getRealPath() === $targetDir || isset($filesCreatedWhileMirroring[$file->getRealPath()])) { |
500 | 500 | continue; |
501 | 501 | } |
502 | - $target = $targetDir . \substr($file->getPathname(), $originDirLen); |
|
502 | + $target = $targetDir.\substr($file->getPathname(), $originDirLen); |
|
503 | 503 | $filesCreatedWhileMirroring[$target] = \true; |
504 | - if (!$copyOnWindows && \is_link($file)) { |
|
504 | + if ( ! $copyOnWindows && \is_link($file)) { |
|
505 | 505 | $this->symlink($file->getLinkTarget(), $target); |
506 | 506 | } elseif (\is_dir($file)) { |
507 | 507 | $this->mkdir($target); |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | // If tempnam failed or no scheme return the filename otherwise prepend the scheme |
545 | 545 | if (\false !== $tmpFile) { |
546 | 546 | if (null !== $scheme && 'gs' !== $scheme) { |
547 | - return $scheme . '://' . $tmpFile; |
|
547 | + return $scheme.'://'.$tmpFile; |
|
548 | 548 | } |
549 | 549 | return $tmpFile; |
550 | 550 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | // Loop until we create a valid temp file or have reached 10 attempts |
554 | 554 | for ($i = 0; $i < 10; ++$i) { |
555 | 555 | // Create a unique filename |
556 | - $tmpFile = $dir . '/' . $prefix . \uniqid(\mt_rand(), \true); |
|
556 | + $tmpFile = $dir.'/'.$prefix.\uniqid(\mt_rand(), \true); |
|
557 | 557 | // Use fopen instead of file_exists as some streams do not support stat |
558 | 558 | // Use mode 'x+' to atomically check existence and create to avoid a TOCTOU vulnerability |
559 | 559 | $handle = @\fopen($tmpFile, 'x+'); |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | @\trigger_error(\sprintf('Calling "%s()" with an array in the $content argument is deprecated since Symfony 4.3.', __METHOD__), \E_USER_DEPRECATED); |
582 | 582 | } |
583 | 583 | $dir = \dirname($filename); |
584 | - if (!\is_dir($dir)) { |
|
584 | + if ( ! \is_dir($dir)) { |
|
585 | 585 | $this->mkdir($dir); |
586 | 586 | } |
587 | 587 | // Will create a temp file with 0600 access rights |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | @\trigger_error(\sprintf('Calling "%s()" with an array in the $content argument is deprecated since Symfony 4.3.', __METHOD__), \E_USER_DEPRECATED); |
614 | 614 | } |
615 | 615 | $dir = \dirname($filename); |
616 | - if (!\is_dir($dir)) { |
|
616 | + if ( ! \is_dir($dir)) { |
|
617 | 617 | $this->mkdir($dir); |
618 | 618 | } |
619 | 619 | if (\false === @\file_put_contents($filename, $content, \FILE_APPEND)) { |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | } |
635 | 635 | private static function assertFunctionExists(string $func) : void |
636 | 636 | { |
637 | - if (!\function_exists($func)) { |
|
637 | + if ( ! \function_exists($func)) { |
|
638 | 638 | throw new IOException(\sprintf('Unable to perform filesystem operation because the "%s()" function has been disabled.', $func)); |
639 | 639 | } |
640 | 640 | } |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | { |
648 | 648 | self::assertFunctionExists($func); |
649 | 649 | self::$lastError = null; |
650 | - \set_error_handler(__CLASS__ . '::handleError'); |
|
650 | + \set_error_handler(__CLASS__.'::handleError'); |
|
651 | 651 | try { |
652 | 652 | $result = $func(...$args); |
653 | 653 | \restore_error_handler(); |
@@ -14,21 +14,21 @@ discard block |
||
14 | 14 | if (\PHP_VERSION_ID >= 70300) { |
15 | 15 | return; |
16 | 16 | } |
17 | -if (!\function_exists('is_countable')) { |
|
17 | +if ( ! \function_exists('is_countable')) { |
|
18 | 18 | function is_countable($value) |
19 | 19 | { |
20 | 20 | return \is_array($value) || $value instanceof \Countable || $value instanceof \ResourceBundle || $value instanceof \SimpleXmlElement; |
21 | 21 | } |
22 | 22 | } |
23 | -if (!\function_exists('hrtime')) { |
|
24 | - require_once __DIR__ . '/Php73.php'; |
|
23 | +if ( ! \function_exists('hrtime')) { |
|
24 | + require_once __DIR__.'/Php73.php'; |
|
25 | 25 | p\Php73::$startAt = (int) \microtime(\true); |
26 | 26 | function hrtime($as_number = \false) |
27 | 27 | { |
28 | 28 | return p\Php73::hrtime($as_number); |
29 | 29 | } |
30 | 30 | } |
31 | -if (!\function_exists('array_key_first')) { |
|
31 | +if ( ! \function_exists('array_key_first')) { |
|
32 | 32 | function array_key_first(array $array) |
33 | 33 | { |
34 | 34 | foreach ($array as $key => $value) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | } |
38 | 38 | } |
39 | -if (!\function_exists('array_key_last')) { |
|
39 | +if ( ! \function_exists('array_key_last')) { |
|
40 | 40 | function array_key_last(array $array) |
41 | 41 | { |
42 | 42 | return \key(\array_slice($array, -1, 1, \true)); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public static function ctype_alnum($text) |
32 | 32 | { |
33 | 33 | $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); |
34 | - return \is_string($text) && '' !== $text && !\preg_match('/[^A-Za-z0-9]/', $text); |
|
34 | + return \is_string($text) && '' !== $text && ! \preg_match('/[^A-Za-z0-9]/', $text); |
|
35 | 35 | } |
36 | 36 | /** |
37 | 37 | * Returns TRUE if every character in text is a letter, FALSE otherwise. |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public static function ctype_alpha($text) |
46 | 46 | { |
47 | 47 | $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); |
48 | - return \is_string($text) && '' !== $text && !\preg_match('/[^A-Za-z]/', $text); |
|
48 | + return \is_string($text) && '' !== $text && ! \preg_match('/[^A-Za-z]/', $text); |
|
49 | 49 | } |
50 | 50 | /** |
51 | 51 | * Returns TRUE if every character in text is a control character from the current locale, FALSE otherwise. |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public static function ctype_cntrl($text) |
60 | 60 | { |
61 | 61 | $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); |
62 | - return \is_string($text) && '' !== $text && !\preg_match('/[^\\x00-\\x1f\\x7f]/', $text); |
|
62 | + return \is_string($text) && '' !== $text && ! \preg_match('/[^\\x00-\\x1f\\x7f]/', $text); |
|
63 | 63 | } |
64 | 64 | /** |
65 | 65 | * Returns TRUE if every character in the string text is a decimal digit, FALSE otherwise. |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | public static function ctype_digit($text) |
74 | 74 | { |
75 | 75 | $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); |
76 | - return \is_string($text) && '' !== $text && !\preg_match('/[^0-9]/', $text); |
|
76 | + return \is_string($text) && '' !== $text && ! \preg_match('/[^0-9]/', $text); |
|
77 | 77 | } |
78 | 78 | /** |
79 | 79 | * Returns TRUE if every character in text is printable and actually creates visible output (no white space), FALSE otherwise. |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public static function ctype_graph($text) |
88 | 88 | { |
89 | 89 | $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); |
90 | - return \is_string($text) && '' !== $text && !\preg_match('/[^!-~]/', $text); |
|
90 | + return \is_string($text) && '' !== $text && ! \preg_match('/[^!-~]/', $text); |
|
91 | 91 | } |
92 | 92 | /** |
93 | 93 | * Returns TRUE if every character in text is a lowercase letter. |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | public static function ctype_lower($text) |
102 | 102 | { |
103 | 103 | $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); |
104 | - return \is_string($text) && '' !== $text && !\preg_match('/[^a-z]/', $text); |
|
104 | + return \is_string($text) && '' !== $text && ! \preg_match('/[^a-z]/', $text); |
|
105 | 105 | } |
106 | 106 | /** |
107 | 107 | * Returns TRUE if every character in text will actually create output (including blanks). Returns FALSE if text contains control characters or characters that do not have any output or control function at all. |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | public static function ctype_print($text) |
116 | 116 | { |
117 | 117 | $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); |
118 | - return \is_string($text) && '' !== $text && !\preg_match('/[^ -~]/', $text); |
|
118 | + return \is_string($text) && '' !== $text && ! \preg_match('/[^ -~]/', $text); |
|
119 | 119 | } |
120 | 120 | /** |
121 | 121 | * Returns TRUE if every character in text is printable, but neither letter, digit or blank, FALSE otherwise. |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public static function ctype_punct($text) |
130 | 130 | { |
131 | 131 | $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); |
132 | - return \is_string($text) && '' !== $text && !\preg_match('/[^!-\\/\\:-@\\[-`\\{-~]/', $text); |
|
132 | + return \is_string($text) && '' !== $text && ! \preg_match('/[^!-\\/\\:-@\\[-`\\{-~]/', $text); |
|
133 | 133 | } |
134 | 134 | /** |
135 | 135 | * Returns TRUE if every character in text creates some sort of white space, FALSE otherwise. Besides the blank character this also includes tab, vertical tab, line feed, carriage return and form feed characters. |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | public static function ctype_space($text) |
144 | 144 | { |
145 | 145 | $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); |
146 | - return \is_string($text) && '' !== $text && !\preg_match('/[^\\s]/', $text); |
|
146 | + return \is_string($text) && '' !== $text && ! \preg_match('/[^\\s]/', $text); |
|
147 | 147 | } |
148 | 148 | /** |
149 | 149 | * Returns TRUE if every character in text is an uppercase letter. |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | public static function ctype_upper($text) |
158 | 158 | { |
159 | 159 | $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); |
160 | - return \is_string($text) && '' !== $text && !\preg_match('/[^A-Z]/', $text); |
|
160 | + return \is_string($text) && '' !== $text && ! \preg_match('/[^A-Z]/', $text); |
|
161 | 161 | } |
162 | 162 | /** |
163 | 163 | * Returns TRUE if every character in text is a hexadecimal 'digit', that is a decimal digit or a character from [A-Fa-f] , FALSE otherwise. |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | public static function ctype_xdigit($text) |
172 | 172 | { |
173 | 173 | $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); |
174 | - return \is_string($text) && '' !== $text && !\preg_match('/[^A-Fa-f0-9]/', $text); |
|
174 | + return \is_string($text) && '' !== $text && ! \preg_match('/[^A-Fa-f0-9]/', $text); |
|
175 | 175 | } |
176 | 176 | /** |
177 | 177 | * Converts integers to their char versions according to normal ctype behaviour, if needed. |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | */ |
189 | 189 | private static function convert_int_to_char_for_ctype($int, $function) |
190 | 190 | { |
191 | - if (!\is_int($int)) { |
|
191 | + if ( ! \is_int($int)) { |
|
192 | 192 | return $int; |
193 | 193 | } |
194 | 194 | if ($int < -128 || $int > 255) { |
195 | 195 | return (string) $int; |
196 | 196 | } |
197 | 197 | if (\PHP_VERSION_ID >= 80100) { |
198 | - @\trigger_error($function . '(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED); |
|
198 | + @\trigger_error($function.'(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED); |
|
199 | 199 | } |
200 | 200 | if ($int < 0) { |
201 | 201 | $int += 256; |
@@ -11,67 +11,67 @@ |
||
11 | 11 | * file that was distributed with this source code. |
12 | 12 | */ |
13 | 13 | use Wordlift\Modules\Common\Symfony\Polyfill\Ctype as p; |
14 | -if (!\function_exists('ctype_alnum')) { |
|
14 | +if ( ! \function_exists('ctype_alnum')) { |
|
15 | 15 | function ctype_alnum(mixed $text) : bool |
16 | 16 | { |
17 | 17 | return p\Ctype::ctype_alnum($text); |
18 | 18 | } |
19 | 19 | } |
20 | -if (!\function_exists('ctype_alpha')) { |
|
20 | +if ( ! \function_exists('ctype_alpha')) { |
|
21 | 21 | function ctype_alpha(mixed $text) : bool |
22 | 22 | { |
23 | 23 | return p\Ctype::ctype_alpha($text); |
24 | 24 | } |
25 | 25 | } |
26 | -if (!\function_exists('ctype_cntrl')) { |
|
26 | +if ( ! \function_exists('ctype_cntrl')) { |
|
27 | 27 | function ctype_cntrl(mixed $text) : bool |
28 | 28 | { |
29 | 29 | return p\Ctype::ctype_cntrl($text); |
30 | 30 | } |
31 | 31 | } |
32 | -if (!\function_exists('ctype_digit')) { |
|
32 | +if ( ! \function_exists('ctype_digit')) { |
|
33 | 33 | function ctype_digit(mixed $text) : bool |
34 | 34 | { |
35 | 35 | return p\Ctype::ctype_digit($text); |
36 | 36 | } |
37 | 37 | } |
38 | -if (!\function_exists('ctype_graph')) { |
|
38 | +if ( ! \function_exists('ctype_graph')) { |
|
39 | 39 | function ctype_graph(mixed $text) : bool |
40 | 40 | { |
41 | 41 | return p\Ctype::ctype_graph($text); |
42 | 42 | } |
43 | 43 | } |
44 | -if (!\function_exists('ctype_lower')) { |
|
44 | +if ( ! \function_exists('ctype_lower')) { |
|
45 | 45 | function ctype_lower(mixed $text) : bool |
46 | 46 | { |
47 | 47 | return p\Ctype::ctype_lower($text); |
48 | 48 | } |
49 | 49 | } |
50 | -if (!\function_exists('ctype_print')) { |
|
50 | +if ( ! \function_exists('ctype_print')) { |
|
51 | 51 | function ctype_print(mixed $text) : bool |
52 | 52 | { |
53 | 53 | return p\Ctype::ctype_print($text); |
54 | 54 | } |
55 | 55 | } |
56 | -if (!\function_exists('ctype_punct')) { |
|
56 | +if ( ! \function_exists('ctype_punct')) { |
|
57 | 57 | function ctype_punct(mixed $text) : bool |
58 | 58 | { |
59 | 59 | return p\Ctype::ctype_punct($text); |
60 | 60 | } |
61 | 61 | } |
62 | -if (!\function_exists('ctype_space')) { |
|
62 | +if ( ! \function_exists('ctype_space')) { |
|
63 | 63 | function ctype_space(mixed $text) : bool |
64 | 64 | { |
65 | 65 | return p\Ctype::ctype_space($text); |
66 | 66 | } |
67 | 67 | } |
68 | -if (!\function_exists('ctype_upper')) { |
|
68 | +if ( ! \function_exists('ctype_upper')) { |
|
69 | 69 | function ctype_upper(mixed $text) : bool |
70 | 70 | { |
71 | 71 | return p\Ctype::ctype_upper($text); |
72 | 72 | } |
73 | 73 | } |
74 | -if (!\function_exists('ctype_xdigit')) { |
|
74 | +if ( ! \function_exists('ctype_xdigit')) { |
|
75 | 75 | function ctype_xdigit(mixed $text) : bool |
76 | 76 | { |
77 | 77 | return p\Ctype::ctype_xdigit($text); |