Completed
Pull Request — master (#671)
by Antonio
10:42 queued 07:34
created
tests/unit/ClassDiscovery/RelativeNamespaceDiscoveryTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     public function testGetClasses()
14 14
     {
15 15
         $classLoader = new ClassLoader();
16
-        $classLoader->addPsr4('\\Robo\\', [realpath(__DIR__.'/../../src')]);
16
+        $classLoader->addPsr4('\\Robo\\', [realpath(__DIR__ . '/../../src')]);
17 17
         $service = new RelativeNamespaceDiscovery($classLoader);
18 18
         $service->setRelativeNamespace('\Commands');
19 19
         $classes = $service->getClasses();
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     public function testGetFile()
26 26
     {
27 27
         $classLoader = new ClassLoader();
28
-        $classLoader->addPsr4('\\Robo\\', [realpath(__DIR__.'/../../src')]);
28
+        $classLoader->addPsr4('\\Robo\\', [realpath(__DIR__ . '/../../src')]);
29 29
         $service = new RelativeNamespaceDiscovery($classLoader);
30 30
         $service->setRelativeNamespace('\Commands');
31 31
 
Please login to merge, or discard this patch.
src/ClassDiscovery/RelativeNamespaceDiscovery.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
         $relativePath = $this->convertNamespaceToPath($this->relativeNamespace);
54 54
 
55 55
         foreach ($this->classLoader->getPrefixesPsr4() as $baseNamespace => $directories) {
56
-            $directories = array_filter(array_map(function ($directory) use ($relativePath) {
57
-                return $directory.$relativePath;
56
+            $directories = array_filter(array_map(function($directory) use ($relativePath) {
57
+                return $directory . $relativePath;
58 58
             }, $directories), 'is_dir');
59 59
 
60 60
             if ($directories) {
61 61
                 foreach ($this->search($directories, $this->searchPattern) as $file) {
62 62
                     $relativePathName = $file->getRelativePathname();
63
-                    $classes[] = $baseNamespace.$this->convertPathToNamespace($relativePath.'/'.$relativePathName);
63
+                    $classes[] = $baseNamespace . $this->convertPathToNamespace($relativePath . '/' . $relativePathName);
64 64
                 }
65 65
             }
66 66
         }
@@ -107,6 +107,6 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function convertNamespaceToPath($namespace)
109 109
     {
110
-        return '/'.str_replace("\\", '/', trim($namespace, '\\'));
110
+        return '/' . str_replace("\\", '/', trim($namespace, '\\'));
111 111
     }
112 112
 }
Please login to merge, or discard this patch.