@@ -146,7 +146,7 @@ |
||
146 | 146 | * |
147 | 147 | * @return bool |
148 | 148 | */ |
149 | - function ($checkPassed, Requirement $requirement) { |
|
149 | + function($checkPassed, Requirement $requirement) { |
|
150 | 150 | return $checkPassed && $requirement->isFulfilled(); |
151 | 151 | }, |
152 | 152 | true |
@@ -46,7 +46,7 @@ |
||
46 | 46 | $this->fulfilled = eval($this->checkIsFulfilled); |
47 | 47 | } |
48 | 48 | |
49 | - return (bool) $this->fulfilled; // Cast to boolean, `(bool)` and `boolval()` are not available in PHP 5.3 |
|
49 | + return (bool) $this->fulfilled; // Cast to boolean, `(bool)` and `boolval()` are not available in PHP 5.3 |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | |
19 | 19 | return [ |
20 | 20 | 'patchers' => [ |
21 | - function (string $filePath, string $prefix, string $contents): string { |
|
21 | + function(string $filePath, string $prefix, string $contents): string { |
|
22 | 22 | $finderClass = sprintf('\%s\%s', $prefix, Finder::class); |
23 | 23 | |
24 | 24 | return str_replace($finderClass, '\\'.Finder::class, $contents); |
25 | 25 | }, |
26 | - function (string $filePath, string $prefix, string $contents): string { |
|
26 | + function(string $filePath, string $prefix, string $contents): string { |
|
27 | 27 | $file = 'vendor/beberlei/assert/lib/Assert/Assertion.php'; |
28 | 28 | |
29 | 29 | if ($filePath !== $file) { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $contents |
40 | 40 | ); |
41 | 41 | }, |
42 | - function (string $filePath, string $prefix, string $contents): string { |
|
42 | + function(string $filePath, string $prefix, string $contents): string { |
|
43 | 43 | $files = [ |
44 | 44 | 'src/functions.php', |
45 | 45 | 'src/Configuration.php', |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $contents |
68 | 68 | ); |
69 | 69 | }, |
70 | - function (string $filePath, string $prefix, string $contents): string { |
|
70 | + function(string $filePath, string $prefix, string $contents): string { |
|
71 | 71 | if ('vendor/composer/composer/src/Composer/Autoload/AutoloadGenerator.php' !== $filePath) { |
72 | 72 | return $contents; |
73 | 73 | } |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | $contents |
82 | 82 | ); |
83 | 83 | }, |
84 | - function (string $filePath, string $prefix, string $contents) use ($classLoaderContents): string { |
|
84 | + function(string $filePath, string $prefix, string $contents) use ($classLoaderContents): string { |
|
85 | 85 | return 'vendor/composer/composer/src/Composer/Autoload/ClassLoader.php' === $filePath ? $classLoaderContents : $contents; |
86 | 86 | }, |
87 | - function (string $filePath, string $prefix, string $contents): string { |
|
87 | + function(string $filePath, string $prefix, string $contents): string { |
|
88 | 88 | if ('src/bootstrap.php' !== $filePath) { |
89 | 89 | return $contents; |
90 | 90 | } |
@@ -98,7 +98,7 @@ |
||
98 | 98 | ); |
99 | 99 | |
100 | 100 | $this->assertFalse($requirement->isFulfilled()); |
101 | - $this->assertFalse($requirement->isFulfilled()); // Would have gave `true` if it was evaluated a second time |
|
101 | + $this->assertFalse($requirement->isFulfilled()); // Would have gave `true` if it was evaluated a second time |
|
102 | 102 | |
103 | 103 | unset($GLOBALS['x']); |
104 | 104 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | { |
64 | 64 | $phpVersion = PHP_VERSION; |
65 | 65 | |
66 | - yield (function () use ($phpVersion) { |
|
66 | + yield (function() use ($phpVersion) { |
|
67 | 67 | return [ |
68 | 68 | new RequirementCollection(), |
69 | 69 | IO::VERBOSITY_DEBUG, |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | ]; |
89 | 89 | })(); |
90 | 90 | |
91 | - yield (function () use ($phpVersion) { |
|
91 | + yield (function() use ($phpVersion) { |
|
92 | 92 | return [ |
93 | 93 | new RequirementCollection(), |
94 | 94 | IO::VERBOSITY_VERY_VERBOSE, |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | })(); |
115 | 115 | |
116 | 116 | foreach ([IO::VERBOSITY_VERBOSE, IO::VERBOSITY_NORMAL, IO::VERBOSITY_QUIET] as $verbosity) { |
117 | - yield (function () use ($verbosity) { |
|
117 | + yield (function() use ($verbosity) { |
|
118 | 118 | return [ |
119 | 119 | new RequirementCollection(), |
120 | 120 | $verbosity, |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | })(); |
125 | 125 | } |
126 | 126 | |
127 | - yield (function () use ($phpVersion) { |
|
127 | + yield (function() use ($phpVersion) { |
|
128 | 128 | $requirements = new RequirementCollection(); |
129 | 129 | |
130 | 130 | $requirements->addRequirement( |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | ]; |
165 | 165 | })(); |
166 | 166 | |
167 | - yield (function () use ($phpVersion) { |
|
167 | + yield (function() use ($phpVersion) { |
|
168 | 168 | $requirements = new RequirementCollection(); |
169 | 169 | |
170 | 170 | $requirements->addRequirement( |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | })(); |
205 | 205 | |
206 | 206 | foreach ([IO::VERBOSITY_VERBOSE, IO::VERBOSITY_NORMAL, IO::VERBOSITY_QUIET] as $verbosity) { |
207 | - yield (function () use ($verbosity) { |
|
207 | + yield (function() use ($verbosity) { |
|
208 | 208 | $requirements = new RequirementCollection(); |
209 | 209 | |
210 | 210 | $requirements->addRequirement( |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | })(); |
228 | 228 | } |
229 | 229 | |
230 | - yield (function () use ($phpVersion) { |
|
230 | + yield (function() use ($phpVersion) { |
|
231 | 231 | $requirements = new RequirementCollection(); |
232 | 232 | |
233 | 233 | $requirements->addRequirement( |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | })(); |
276 | 276 | |
277 | 277 | foreach ([IO::VERBOSITY_VERY_VERBOSE, IO::VERBOSITY_VERBOSE, IO::VERBOSITY_NORMAL] as $verbosity) { |
278 | - yield (function () use ($verbosity, $phpVersion) { |
|
278 | + yield (function() use ($verbosity, $phpVersion) { |
|
279 | 279 | $requirements = new RequirementCollection(); |
280 | 280 | |
281 | 281 | $requirements->addRequirement( |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | })(); |
322 | 322 | } |
323 | 323 | |
324 | - yield (function () use ($phpVersion) { |
|
324 | + yield (function() use ($phpVersion) { |
|
325 | 325 | $requirements = new RequirementCollection(); |
326 | 326 | |
327 | 327 | $requirements->addRequirement( |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | return array_filter( |
59 | 59 | array_map( |
60 | - function (string $packageName) use ($vendorDir): ?string { |
|
60 | + function(string $packageName) use ($vendorDir): ?string { |
|
61 | 61 | $realPath = realpath($vendorDir.DIRECTORY_SEPARATOR.$packageName); |
62 | 62 | |
63 | 63 | return false !== $realPath ? $realPath : null; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | return array_map( |
93 | - function (array $package): string { |
|
93 | + function(array $package): string { |
|
94 | 94 | return $package['name']; |
95 | 95 | }, |
96 | 96 | $composerLockDecodedContents['packages-dev'] |
@@ -56,7 +56,7 @@ |
||
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | - return false === $assoc ? (object) $data : $data; // If JSON is an empty JSON json_decode returns an empty |
|
59 | + return false === $assoc ? (object) $data : $data; // If JSON is an empty JSON json_decode returns an empty |
|
60 | 60 | // array instead of an stdClass instance |
61 | 61 | } |
62 | 62 |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $this->file = $file; |
85 | 85 | |
86 | 86 | $this->basePath = getcwd(); |
87 | - $this->mapFile = function (): void { }; |
|
87 | + $this->mapFile = function(): void { }; |
|
88 | 88 | $this->scoper = new NullScoper(); |
89 | 89 | } |
90 | 90 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | public function addFiles(array $files, bool $binary, bool $dumpAutoload = false): void |
171 | 171 | { |
172 | 172 | $files = array_map( |
173 | - function ($file): string { |
|
173 | + function($file): string { |
|
174 | 174 | // Convert files to string as SplFileInfo is not serializable |
175 | 175 | return (string) $file; |
176 | 176 | }, |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | $mapFile = $this->mapFile; |
315 | 315 | $placeholders = $this->placeholders; |
316 | 316 | $compactors = $this->compactors; |
317 | - $bootstrap = $GLOBALS['_BOX_BOOTSTRAP'] ?? function (): void {}; |
|
317 | + $bootstrap = $GLOBALS['_BOX_BOOTSTRAP'] ?? function(): void {}; |
|
318 | 318 | |
319 | - $processFile = function (string $file) use ($cwd, $basePath, $mapFile, $placeholders, $compactors, $bootstrap): array { |
|
319 | + $processFile = function(string $file) use ($cwd, $basePath, $mapFile, $placeholders, $compactors, $bootstrap): array { |
|
320 | 320 | chdir($cwd); |
321 | 321 | $bootstrap(); |
322 | 322 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | { |
366 | 366 | return array_reduce( |
367 | 367 | $compactors, |
368 | - function (string $contents, Compactor $compactor) use ($file): string { |
|
368 | + function(string $contents, Compactor $compactor) use ($file): string { |
|
369 | 369 | return $compactor->compact($file, $contents); |
370 | 370 | }, |
371 | 371 | $contents |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | { |
566 | 566 | $blacklist = self::retrieveBlacklist($raw, $basePath, ...$excludedPaths); |
567 | 567 | |
568 | - $blacklistFilter = function (SplFileInfo $file) use ($blacklist): ?bool { |
|
568 | + $blacklistFilter = function(SplFileInfo $file) use ($blacklist): ?bool { |
|
569 | 569 | if ($file->isLink()) { |
570 | 570 | return false; |
571 | 571 | } |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | |
638 | 638 | Assertion::allString($files); |
639 | 639 | |
640 | - $normalizePath = function (string $file) use ($basePath, $key, $mainScriptPath): ?SplFileInfo { |
|
640 | + $normalizePath = function(string $file) use ($basePath, $key, $mainScriptPath): ?SplFileInfo { |
|
641 | 641 | $file = self::normalizePath($file, $basePath); |
642 | 642 | |
643 | 643 | if (is_link($file)) { |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | Closure $blacklistFilter, |
756 | 756 | array $devPackages |
757 | 757 | ): array { |
758 | - $processFinderConfig = function (stdClass $config) use ($basePath, $blacklistFilter, $devPackages) { |
|
758 | + $processFinderConfig = function(stdClass $config) use ($basePath, $blacklistFilter, $devPackages) { |
|
759 | 759 | return self::processFinder($config, $basePath, $blacklistFilter, $devPackages); |
760 | 760 | }; |
761 | 761 | |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | ->files() |
781 | 781 | ->filter($blacklistFilter) |
782 | 782 | ->filter( |
783 | - function (SplFileInfo $fileInfo) use ($devPackages): bool { |
|
783 | + function(SplFileInfo $fileInfo) use ($devPackages): bool { |
|
784 | 784 | foreach ($devPackages as $devPackage) { |
785 | 785 | if ($devPackage === longest_common_base_path([$devPackage, $fileInfo->getRealPath()])) { |
786 | 786 | // File belongs to the dev package |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | ->ignoreVCS(true) |
795 | 795 | ; |
796 | 796 | |
797 | - $normalizedConfig = (function (array $config, Finder $finder): array { |
|
797 | + $normalizedConfig = (function(array $config, Finder $finder): array { |
|
798 | 798 | $normalizedConfig = []; |
799 | 799 | |
800 | 800 | foreach ($config as $method => $arguments) { |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | return $normalizedConfig; |
816 | 816 | })((array) $config, $finder); |
817 | 817 | |
818 | - $createNormalizedDirectories = function (string $directory) use ($basePath): ?string { |
|
818 | + $createNormalizedDirectories = function(string $directory) use ($basePath): ?string { |
|
819 | 819 | $directory = self::normalizePath($directory, $basePath); |
820 | 820 | |
821 | 821 | if (is_link($directory)) { |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | return $directory; |
834 | 834 | }; |
835 | 835 | |
836 | - $normalizeFileOrDirectory = function (string &$fileOrDirectory) use ($basePath, $blacklistFilter): void { |
|
836 | + $normalizeFileOrDirectory = function(string &$fileOrDirectory) use ($basePath, $blacklistFilter): void { |
|
837 | 837 | $fileOrDirectory = self::normalizePath($fileOrDirectory, $basePath); |
838 | 838 | |
839 | 839 | if (is_link($fileOrDirectory)) { |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | ): array { |
907 | 907 | $excludedPaths = array_flip($excludedPaths); |
908 | 908 | |
909 | - $toString = function ($file): string { |
|
909 | + $toString = function($file): string { |
|
910 | 910 | // @param string|SplFileInfo $file |
911 | 911 | return (string) $file; |
912 | 912 | }; |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | ->depth(1) |
929 | 929 | ->ignoreUnreadableDirs() |
930 | 930 | ->filter( |
931 | - function (SplFileInfo $fileInfo): ?bool { |
|
931 | + function(SplFileInfo $fileInfo): ?bool { |
|
932 | 932 | if ($fileInfo->isLink()) { |
933 | 933 | return false; |
934 | 934 | } |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | } |
1003 | 1003 | } |
1004 | 1004 | |
1005 | - $normalizePath = function (string $path) use ($basePath): string { |
|
1005 | + $normalizePath = function(string $path) use ($basePath): string { |
|
1006 | 1006 | return is_absolute_path($path) |
1007 | 1007 | ? canonicalize($path) |
1008 | 1008 | : self::normalizePath(trim($path, '/ '), $basePath) |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | array $devPackages |
1061 | 1061 | ): array { |
1062 | 1062 | $relativeDevPackages = array_map( |
1063 | - function (string $packagePath) use ($basePath): string { |
|
1063 | + function(string $packagePath) use ($basePath): string { |
|
1064 | 1064 | return make_path_relative($packagePath, $basePath); |
1065 | 1065 | }, |
1066 | 1066 | $devPackages |
@@ -1149,12 +1149,12 @@ discard block |
||
1149 | 1149 | $excludedPaths = array_unique( |
1150 | 1150 | array_filter( |
1151 | 1151 | array_map( |
1152 | - function (string $path) use ($basePath): string { |
|
1152 | + function(string $path) use ($basePath): string { |
|
1153 | 1153 | return make_path_relative($path, $basePath); |
1154 | 1154 | }, |
1155 | 1155 | $excludedPaths |
1156 | 1156 | ), |
1157 | - function (string $path): bool { |
|
1157 | + function(string $path): bool { |
|
1158 | 1158 | return '..' !== substr($path, 0, 2); |
1159 | 1159 | } |
1160 | 1160 | ) |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | |
1190 | 1190 | $directories = $raw->{$key}; |
1191 | 1191 | |
1192 | - $normalizeDirectory = function (string $directory) use ($basePath, $key): string { |
|
1192 | + $normalizeDirectory = function(string $directory) use ($basePath, $key): string { |
|
1193 | 1193 | $directory = self::normalizePath($directory, $basePath); |
1194 | 1194 | |
1195 | 1195 | if (is_link($directory)) { |
@@ -1233,7 +1233,7 @@ discard block |
||
1233 | 1233 | $compactorClasses = array_unique((array) $raw->compactors); |
1234 | 1234 | |
1235 | 1235 | return array_map( |
1236 | - function (string $class) use ($raw, $basePath): Compactor { |
|
1236 | + function(string $class) use ($raw, $basePath): Compactor { |
|
1237 | 1237 | Assertion::classExists($class, 'The compactor class "%s" does not exist.'); |
1238 | 1238 | Assertion::implementsInterface($class, Compactor::class, 'The class "%s" is not a compactor class.'); |
1239 | 1239 | |
@@ -1323,7 +1323,7 @@ discard block |
||
1323 | 1323 | |
1324 | 1324 | private static function retrieveComposerFiles(string $basePath): array |
1325 | 1325 | { |
1326 | - $retrieveFileAndContents = function (string $file): array { |
|
1326 | + $retrieveFileAndContents = function(string $file): array { |
|
1327 | 1327 | $json = new Json(); |
1328 | 1328 | |
1329 | 1329 | if (false === file_exists($file) || false === is_file($file) || false === is_readable($file)) { |