Completed
Push — master ( 6f9845...68f10d )
by Marco
12:19 queued 14s
created
src/SourceLocator/Type/Composer/PsrAutoloaderLocator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
     public function locateIdentifier(Reflector $reflector, Identifier $identifier) : ?Reflection
37 37
     {
38 38
         foreach ($this->mapping->resolvePossibleFilePaths($identifier) as $file) {
39
-            if (! file_exists($file)) {
39
+            if (!file_exists($file)) {
40 40
                 continue;
41 41
             }
42 42
 
Please login to merge, or discard this patch.
src/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerJson.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -29,25 +29,25 @@  discard block
 block discarded – undo
29 29
 {
30 30
     public function __invoke(string $installationPath, Locator $astLocator) : SourceLocator
31 31
     {
32
-        $realInstallationPath = (string) realpath($installationPath);
32
+        $realInstallationPath = (string)realpath($installationPath);
33 33
 
34
-        if (! is_dir($realInstallationPath)) {
34
+        if (!is_dir($realInstallationPath)) {
35 35
             throw InvalidProjectDirectory::atPath($installationPath);
36 36
         }
37 37
 
38
-        $composerJsonPath = $realInstallationPath . '/composer.json';
38
+        $composerJsonPath = $realInstallationPath.'/composer.json';
39 39
 
40
-        if (! file_exists($composerJsonPath)) {
40
+        if (!file_exists($composerJsonPath)) {
41 41
             throw MissingComposerJson::inProjectPath($installationPath);
42 42
         }
43 43
 
44
-        $composer = json_decode((string) file_get_contents($composerJsonPath), true);
44
+        $composer = json_decode((string)file_get_contents($composerJsonPath), true);
45 45
 
46
-        if (! is_array($composer)) {
46
+        if (!is_array($composer)) {
47 47
             throw FailedToParseJson::inFile($composerJsonPath);
48 48
         }
49 49
 
50
-        $pathPrefix          = $realInstallationPath . '/';
50
+        $pathPrefix          = $realInstallationPath.'/';
51 51
         $classMapPaths       = $this->prefixPaths($this->packageToClassMapPaths($composer), $pathPrefix);
52 52
         $classMapFiles       = array_filter($classMapPaths, 'is_file');
53 53
         $classMapDirectories = array_filter($classMapPaths, 'is_dir');
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
                 ),
70 70
                 new DirectoriesSourceLocator($classMapDirectories, $astLocator),
71 71
             ],
72
-            ...array_map(static function (string $file) use ($astLocator) : array {
72
+            ...array_map(static function(string $file) use ($astLocator) : array {
73 73
                 return [new SingleFileSourceLocator($file, $astLocator)];
74 74
             }, array_merge($classMapFiles, $filePaths))
75 75
         ));
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
      */
83 83
     private function packageToPsr4AutoloadNamespaces(array $package) : array
84 84
     {
85
-        return array_map(static function ($namespacePaths) : array {
86
-            return (array) $namespacePaths;
85
+        return array_map(static function($namespacePaths) : array {
86
+            return (array)$namespacePaths;
87 87
         }, $package['autoload']['psr-4'] ?? []);
88 88
     }
89 89
 
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
      */
95 95
     private function packageToPsr0AutoloadNamespaces(array $package) : array
96 96
     {
97
-        return array_map(static function ($namespacePaths) : array {
98
-            return (array) $namespacePaths;
97
+        return array_map(static function($namespacePaths) : array {
98
+            return (array)$namespacePaths;
99 99
         }, $package['autoload']['psr-0'] ?? []);
100 100
     }
101 101
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     private function prefixWithInstallationPath(array $paths, string $trimmedInstallationPath) : array
128 128
     {
129
-        return array_map(function (array $paths) use ($trimmedInstallationPath) : array {
129
+        return array_map(function(array $paths) use ($trimmedInstallationPath) : array {
130 130
             return $this->prefixPaths($paths, $trimmedInstallationPath);
131 131
         }, $paths);
132 132
     }
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
      */
139 139
     private function prefixPaths(array $paths, string $prefix) : array
140 140
     {
141
-        return array_map(static function (string $path) use ($prefix) {
142
-            return $prefix . $path;
141
+        return array_map(static function(string $path) use ($prefix) {
142
+            return $prefix.$path;
143 143
         }, $paths);
144 144
     }
145 145
 }
Please login to merge, or discard this patch.
src/SourceLocator/Type/Composer/Factory/MakeLocatorForInstalledJson.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,27 +30,27 @@  discard block
 block discarded – undo
30 30
 {
31 31
     public function __invoke(string $installationPath, Locator $astLocator) : SourceLocator
32 32
     {
33
-        $realInstallationPath = (string) realpath($installationPath);
33
+        $realInstallationPath = (string)realpath($installationPath);
34 34
 
35
-        if (! is_dir($realInstallationPath)) {
35
+        if (!is_dir($realInstallationPath)) {
36 36
             throw InvalidProjectDirectory::atPath($installationPath);
37 37
         }
38 38
 
39
-        $installedJsonPath = $realInstallationPath . '/vendor/composer/installed.json';
39
+        $installedJsonPath = $realInstallationPath.'/vendor/composer/installed.json';
40 40
 
41
-        if (! file_exists($installedJsonPath)) {
41
+        if (!file_exists($installedJsonPath)) {
42 42
             throw MissingInstalledJson::inProjectPath($installationPath);
43 43
         }
44 44
 
45
-        $installed = json_decode((string) file_get_contents($installedJsonPath), true);
45
+        $installed = json_decode((string)file_get_contents($installedJsonPath), true);
46 46
 
47
-        if (! is_array($installed)) {
47
+        if (!is_array($installed)) {
48 48
             throw FailedToParseJson::inFile($installedJsonPath);
49 49
         }
50 50
 
51
-        $classMapPaths       = array_merge(
51
+        $classMapPaths = array_merge(
52 52
             [],
53
-            ...array_map(function (array $package) use ($realInstallationPath) : array {
53
+            ...array_map(function(array $package) use ($realInstallationPath) : array {
54 54
                 return $this->prefixPaths(
55 55
                     $this->packageToClassMapPaths($package),
56 56
                     $this->packagePrefixPath($realInstallationPath, $package)
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $classMapDirectories = array_filter($classMapPaths, 'is_dir');
62 62
         $filePaths           = array_merge(
63 63
             [],
64
-            ...array_map(function (array $package) use ($realInstallationPath) : array {
64
+            ...array_map(function(array $package) use ($realInstallationPath) : array {
65 65
                 return $this->prefixPaths(
66 66
                     $this->packageToFilePaths($package),
67 67
                     $this->packagePrefixPath($realInstallationPath, $package)
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                 new PsrAutoloaderLocator(
75 75
                     Psr4Mapping::fromArrayMappings(array_merge_recursive(
76 76
                         [],
77
-                        ...array_map(function (array $package) use ($realInstallationPath) : array {
77
+                        ...array_map(function(array $package) use ($realInstallationPath) : array {
78 78
                             return $this->prefixWithPackagePath(
79 79
                                 $this->packageToPsr4AutoloadNamespaces($package),
80 80
                                 $realInstallationPath,
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                 new PsrAutoloaderLocator(
88 88
                     Psr0Mapping::fromArrayMappings(array_merge_recursive(
89 89
                         [],
90
-                        ...array_map(function (array $package) use ($realInstallationPath) : array {
90
+                        ...array_map(function(array $package) use ($realInstallationPath) : array {
91 91
                             return $this->prefixWithPackagePath(
92 92
                                 $this->packageToPsr0AutoloadNamespaces($package),
93 93
                                 $realInstallationPath,
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
                 ),
100 100
                 new DirectoriesSourceLocator($classMapDirectories, $astLocator),
101 101
             ],
102
-            ...array_map(static function (string $file) use ($astLocator) : array {
102
+            ...array_map(static function(string $file) use ($astLocator) : array {
103 103
                 return [new SingleFileSourceLocator($file, $astLocator)];
104 104
             }, array_merge($classMapFiles, $filePaths))
105 105
         ));
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
      */
113 113
     private function packageToPsr4AutoloadNamespaces(array $package) : array
114 114
     {
115
-        return array_map(static function ($namespacePaths) : array {
116
-            return (array) $namespacePaths;
115
+        return array_map(static function($namespacePaths) : array {
116
+            return (array)$namespacePaths;
117 117
         }, $package['autoload']['psr-4'] ?? []);
118 118
     }
119 119
 
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
      */
125 125
     private function packageToPsr0AutoloadNamespaces(array $package) : array
126 126
     {
127
-        return array_map(static function ($namespacePaths) : array {
128
-            return (array) $namespacePaths;
127
+        return array_map(static function($namespacePaths) : array {
128
+            return (array)$namespacePaths;
129 129
         }, $package['autoload']['psr-0'] ?? []);
130 130
     }
131 131
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     private function packagePrefixPath(string $trimmedInstallationPath, array $package) : string
158 158
     {
159
-        return $trimmedInstallationPath . '/vendor/' . $package['name'] . '/';
159
+        return $trimmedInstallationPath.'/vendor/'.$package['name'].'/';
160 160
     }
161 161
 
162 162
     /**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     {
172 172
         $prefix = $this->packagePrefixPath($trimmedInstallationPath, $package);
173 173
 
174
-        return array_map(function (array $paths) use ($prefix) : array {
174
+        return array_map(function(array $paths) use ($prefix) : array {
175 175
             return $this->prefixPaths($paths, $prefix);
176 176
         }, $paths);
177 177
     }
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
      */
184 184
     private function prefixPaths(array $paths, string $prefix) : array
185 185
     {
186
-        return array_map(static function (string $path) use ($prefix) {
187
-            return $prefix . $path;
186
+        return array_map(static function(string $path) use ($prefix) {
187
+            return $prefix.$path;
188 188
         }, $paths);
189 189
     }
190 190
 }
Please login to merge, or discard this patch.
Type/Composer/Factory/MakeLocatorForComposerJsonAndInstalledJson.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -31,37 +31,37 @@  discard block
 block discarded – undo
31 31
 {
32 32
     public function __invoke(string $installationPath, Locator $astLocator) : SourceLocator
33 33
     {
34
-        $realInstallationPath = (string) realpath($installationPath);
34
+        $realInstallationPath = (string)realpath($installationPath);
35 35
 
36
-        if (! is_dir($realInstallationPath)) {
36
+        if (!is_dir($realInstallationPath)) {
37 37
             throw InvalidProjectDirectory::atPath($installationPath);
38 38
         }
39 39
 
40
-        $composerJsonPath  = $realInstallationPath . '/composer.json';
41
-        $installedJsonPath = $realInstallationPath . '/vendor/composer/installed.json';
40
+        $composerJsonPath  = $realInstallationPath.'/composer.json';
41
+        $installedJsonPath = $realInstallationPath.'/vendor/composer/installed.json';
42 42
 
43
-        if (! file_exists($composerJsonPath)) {
43
+        if (!file_exists($composerJsonPath)) {
44 44
             throw MissingComposerJson::inProjectPath($installationPath);
45 45
         }
46 46
 
47
-        if (! file_exists($installedJsonPath)) {
47
+        if (!file_exists($installedJsonPath)) {
48 48
             throw MissingInstalledJson::inProjectPath($installationPath);
49 49
         }
50 50
 
51
-        $composer  = json_decode((string) file_get_contents($composerJsonPath), true);
52
-        $installed = json_decode((string) file_get_contents($installedJsonPath), true);
51
+        $composer  = json_decode((string)file_get_contents($composerJsonPath), true);
52
+        $installed = json_decode((string)file_get_contents($installedJsonPath), true);
53 53
 
54
-        if (! is_array($composer)) {
54
+        if (!is_array($composer)) {
55 55
             throw FailedToParseJson::inFile($composerJsonPath);
56 56
         }
57 57
 
58
-        if (! is_array($installed)) {
58
+        if (!is_array($installed)) {
59 59
             throw FailedToParseJson::inFile($installedJsonPath);
60 60
         }
61 61
 
62
-        $classMapPaths       = array_merge(
63
-            $this->prefixPaths($this->packageToClassMapPaths($composer), $realInstallationPath . '/'),
64
-            ...array_map(function (array $package) use ($realInstallationPath) : array {
62
+        $classMapPaths = array_merge(
63
+            $this->prefixPaths($this->packageToClassMapPaths($composer), $realInstallationPath.'/'),
64
+            ...array_map(function(array $package) use ($realInstallationPath) : array {
65 65
                 return $this->prefixPaths(
66 66
                     $this->packageToClassMapPaths($package),
67 67
                     $this->packagePrefixPath($realInstallationPath, $package)
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
         $classMapFiles       = array_filter($classMapPaths, 'is_file');
72 72
         $classMapDirectories = array_filter($classMapPaths, 'is_dir');
73 73
         $filePaths           = array_merge(
74
-            $this->prefixPaths($this->packageToFilePaths($composer), $realInstallationPath . '/'),
75
-            ...array_map(function (array $package) use ($realInstallationPath) : array {
74
+            $this->prefixPaths($this->packageToFilePaths($composer), $realInstallationPath.'/'),
75
+            ...array_map(function(array $package) use ($realInstallationPath) : array {
76 76
                 return $this->prefixPaths(
77 77
                     $this->packageToFilePaths($package),
78 78
                     $this->packagePrefixPath($realInstallationPath, $package)
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
                 new PsrAutoloaderLocator(
86 86
                     Psr4Mapping::fromArrayMappings(array_merge_recursive(
87 87
                         $this->prefixWithInstallationPath($this->packageToPsr4AutoloadNamespaces($composer), $realInstallationPath),
88
-                        ...array_map(function (array $package) use ($realInstallationPath) : array {
88
+                        ...array_map(function(array $package) use ($realInstallationPath) : array {
89 89
                             return $this->prefixWithPackagePath(
90 90
                                 $this->packageToPsr4AutoloadNamespaces($package),
91 91
                                 $realInstallationPath,
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                 new PsrAutoloaderLocator(
99 99
                     Psr0Mapping::fromArrayMappings(array_merge_recursive(
100 100
                         $this->prefixWithInstallationPath($this->packageToPsr0AutoloadNamespaces($composer), $realInstallationPath),
101
-                        ...array_map(function (array $package) use ($realInstallationPath) : array {
101
+                        ...array_map(function(array $package) use ($realInstallationPath) : array {
102 102
                             return $this->prefixWithPackagePath(
103 103
                                 $this->packageToPsr0AutoloadNamespaces($package),
104 104
                                 $realInstallationPath,
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
                 ),
111 111
                 new DirectoriesSourceLocator($classMapDirectories, $astLocator),
112 112
             ],
113
-            ...array_map(static function (string $file) use ($astLocator) : array {
113
+            ...array_map(static function(string $file) use ($astLocator) : array {
114 114
                 return [new SingleFileSourceLocator($file, $astLocator)];
115 115
             }, array_merge($classMapFiles, $filePaths))
116 116
         ));
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
      */
124 124
     private function packageToPsr4AutoloadNamespaces(array $package) : array
125 125
     {
126
-        return array_map(static function ($namespacePaths) : array {
127
-            return (array) $namespacePaths;
126
+        return array_map(static function($namespacePaths) : array {
127
+            return (array)$namespacePaths;
128 128
         }, $package['autoload']['psr-4'] ?? []);
129 129
     }
130 130
 
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
      */
136 136
     private function packageToPsr0AutoloadNamespaces(array $package) : array
137 137
     {
138
-        return array_map(static function ($namespacePaths) : array {
139
-            return (array) $namespacePaths;
138
+        return array_map(static function($namespacePaths) : array {
139
+            return (array)$namespacePaths;
140 140
         }, $package['autoload']['psr-0'] ?? []);
141 141
     }
142 142
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
      */
168 168
     private function packagePrefixPath(string $trimmedInstallationPath, array $package) : string
169 169
     {
170
-        return $trimmedInstallationPath . '/vendor/' . $package['name'] . '/';
170
+        return $trimmedInstallationPath.'/vendor/'.$package['name'].'/';
171 171
     }
172 172
 
173 173
     /**
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     {
183 183
         $prefix = $this->packagePrefixPath($trimmedInstallationPath, $package);
184 184
 
185
-        return array_map(function (array $paths) use ($prefix) : array {
185
+        return array_map(function(array $paths) use ($prefix) : array {
186 186
             return $this->prefixPaths($paths, $prefix);
187 187
         }, $paths);
188 188
     }
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
      */
195 195
     private function prefixWithInstallationPath(array $paths, string $trimmedInstallationPath) : array
196 196
     {
197
-        return array_map(function (array $paths) use ($trimmedInstallationPath) : array {
198
-            return $this->prefixPaths($paths, $trimmedInstallationPath . '/');
197
+        return array_map(function(array $paths) use ($trimmedInstallationPath) : array {
198
+            return $this->prefixPaths($paths, $trimmedInstallationPath.'/');
199 199
         }, $paths);
200 200
     }
201 201
 
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
      */
207 207
     private function prefixPaths(array $paths, string $prefix) : array
208 208
     {
209
-        return array_map(static function (string $path) use ($prefix) {
210
-            return $prefix . $path;
209
+        return array_map(static function(string $path) use ($prefix) {
210
+            return $prefix.$path;
211 211
         }, $paths);
212 212
     }
213 213
 }
Please login to merge, or discard this patch.
src/SourceLocator/Type/Composer/Psr/Psr4Mapping.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
         $instance = new self();
39 39
 
40 40
         $instance->mappings = array_map(
41
-            static function (array $directories) : array {
42
-                return array_map(static function (string $directory) : string {
41
+            static function(array $directories) : array {
42
+                return array_map(static function(string $directory) : string {
43 43
                     return rtrim($directory, '/');
44 44
                 }, $directories);
45 45
             },
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     /** {@inheritDoc} */
53 53
     public function resolvePossibleFilePaths(Identifier $identifier) : array
54 54
     {
55
-        if (! $identifier->isClass()) {
55
+        if (!$identifier->isClass()) {
56 56
             return [];
57 57
         }
58 58
 
@@ -61,15 +61,15 @@  discard block
 block discarded – undo
61 61
 
62 62
         return array_values(array_filter(array_merge(
63 63
             [],
64
-            ...array_map(static function (array $paths, string $prefix) use ($className) : array {
64
+            ...array_map(static function(array $paths, string $prefix) use ($className) : array {
65 65
                 $subPath = ltrim(str_replace('\\', '/', substr($className, strlen($prefix))), '/');
66 66
 
67 67
                 if ($subPath === '') {
68 68
                     return [];
69 69
                 }
70 70
 
71
-                return array_map(static function (string $path) use ($subPath) : string {
72
-                    return rtrim($path, '/') . '/' . $subPath . '.php';
71
+                return array_map(static function(string $path) use ($subPath) : string {
72
+                    return rtrim($path, '/').'/'.$subPath.'.php';
73 73
                 }, $paths);
74 74
             }, $matchingPrefixes, array_keys($matchingPrefixes))
75 75
         )));
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     {
81 81
         return array_filter(
82 82
             $this->mappings,
83
-            static function (string $prefix) use ($className) : bool {
83
+            static function(string $prefix) use ($className) : bool {
84 84
                 return strpos($className, $prefix) === 0;
85 85
             },
86 86
             ARRAY_FILTER_USE_KEY
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             }
111 111
 
112 112
             foreach ($paths as $path) {
113
-                if (! is_dir($path)) {
113
+                if (!is_dir($path)) {
114 114
                     throw InvalidPrefixMapping::prefixMappingIsNotADirectory($prefix, $path);
115 115
                 }
116 116
             }
Please login to merge, or discard this patch.
src/SourceLocator/Type/Composer/Psr/Psr0Mapping.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
         $instance = new self();
33 33
 
34 34
         $instance->mappings = array_map(
35
-            static function (array $directories) : array {
36
-                return array_map(static function (string $directory) : string {
35
+            static function(array $directories) : array {
36
+                return array_map(static function(string $directory) : string {
37 37
                     return rtrim($directory, '/');
38 38
                 }, $directories);
39 39
             },
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     /** {@inheritDoc} */
47 47
     public function resolvePossibleFilePaths(Identifier $identifier) : array
48 48
     {
49
-        if (! $identifier->isClass()) {
49
+        if (!$identifier->isClass()) {
50 50
             return [];
51 51
         }
52 52
 
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
         foreach ($this->mappings as $prefix => $paths) {
56 56
             if (strpos($className, $prefix) === 0) {
57 57
                 return array_map(
58
-                    static function (string $path) use ($className) : string {
59
-                        return rtrim($path, '/') . '/' . str_replace(['\\', '_'], '/', $className) . '.php';
58
+                    static function(string $path) use ($className) : string {
59
+                        return rtrim($path, '/').'/'.str_replace(['\\', '_'], '/', $className).'.php';
60 60
                     },
61 61
                     $paths
62 62
                 );
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             }
90 90
 
91 91
             foreach ($paths as $path) {
92
-                if (! is_dir($path)) {
92
+                if (!is_dir($path)) {
93 93
                     throw InvalidPrefixMapping::prefixMappingIsNotADirectory($prefix, $path);
94 94
                 }
95 95
             }
Please login to merge, or discard this patch.