@@ -63,6 +63,9 @@ discard block |
||
63 | 63 | $this->dir = getcwd(); |
64 | 64 | } |
65 | 65 | |
66 | + /** |
|
67 | + * @param string $errorType |
|
68 | + */ |
|
66 | 69 | protected function errorCondtion($msg, $errorType) |
67 | 70 | { |
68 | 71 | $this->errorConditions[$msg] = $errorType; |
@@ -110,7 +113,7 @@ discard block |
||
110 | 113 | } |
111 | 114 | |
112 | 115 | /** |
113 | - * @param array $argv |
|
116 | + * @param string[] $argv |
|
114 | 117 | * @param null|string $appName |
115 | 118 | * @param null|string $appVersion |
116 | 119 | * @param null|\Symfony\Component\Console\Output\OutputInterface $output |
@@ -133,7 +136,7 @@ discard block |
||
133 | 136 | * @param null|\Symfony\Component\Console\Input\InputInterface $input |
134 | 137 | * @param null|\Symfony\Component\Console\Output\OutputInterface $output |
135 | 138 | * @param null|\Robo\Application $app |
136 | - * @param array[] $commandFiles |
|
139 | + * @param null|string $commandFiles |
|
137 | 140 | * @param null|ClassLoader $classLoader |
138 | 141 | * |
139 | 142 | * @return int |
@@ -91,8 +91,8 @@ |
||
91 | 91 | { |
92 | 92 | $finder = new Finder(); |
93 | 93 | $finder->files() |
94 | - ->name($pattern) |
|
95 | - ->in($directories); |
|
94 | + ->name($pattern) |
|
95 | + ->in($directories); |
|
96 | 96 | |
97 | 97 | return $finder; |
98 | 98 | } |
@@ -62,6 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | /** |
64 | 64 | * {@inheritdoc} |
65 | + * @param string $class |
|
65 | 66 | */ |
66 | 67 | public function getFile($class) |
67 | 68 | { |
@@ -70,7 +71,7 @@ discard block |
||
70 | 71 | |
71 | 72 | /** |
72 | 73 | * @param $directories |
73 | - * @param $pattern |
|
74 | + * @param string $pattern |
|
74 | 75 | * |
75 | 76 | * @return \Symfony\Component\Finder\Finder |
76 | 77 | */ |
@@ -85,9 +86,9 @@ discard block |
||
85 | 86 | } |
86 | 87 | |
87 | 88 | /** |
88 | - * @param $path |
|
89 | + * @param string $path |
|
89 | 90 | * |
90 | - * @return mixed |
|
91 | + * @return string |
|
91 | 92 | */ |
92 | 93 | protected function convertPathToNamespace($path) |
93 | 94 | { |
@@ -95,6 +96,7 @@ discard block |
||
95 | 96 | } |
96 | 97 | |
97 | 98 | /** |
99 | + * @param string $namespace |
|
98 | 100 | * @return string |
99 | 101 | */ |
100 | 102 | public function convertNamespaceToPath($namespace) |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | $relativePath = $this->convertNamespaceToPath($this->relativeNamespace); |
42 | 42 | |
43 | 43 | foreach ($this->getClassLoader()->getPrefixesPsr4() as $baseNamespace => $directories) { |
44 | - $directories = array_map(function ($directory) use ($relativePath) { |
|
45 | - return $directory.$relativePath; |
|
44 | + $directories = array_map(function($directory) use ($relativePath) { |
|
45 | + return $directory . $relativePath; |
|
46 | 46 | }, $directories); |
47 | 47 | |
48 | - $directories = array_filter($directories, function ($path) { |
|
48 | + $directories = array_filter($directories, function($path) { |
|
49 | 49 | return is_dir($path); |
50 | 50 | }); |
51 | 51 | |
52 | 52 | if ($directories) { |
53 | 53 | foreach ($this->search($directories, $this->searchPattern) as $file) { |
54 | 54 | $relativePathName = $file->getRelativePathname(); |
55 | - $classes[] = $baseNamespace.$this->convertPathToNamespace($relativePath.DIRECTORY_SEPARATOR.$relativePathName); |
|
55 | + $classes[] = $baseNamespace . $this->convertPathToNamespace($relativePath . DIRECTORY_SEPARATOR . $relativePathName); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | } |
@@ -99,6 +99,6 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function convertNamespaceToPath($namespace) |
101 | 101 | { |
102 | - return DIRECTORY_SEPARATOR.str_replace("\\", DIRECTORY_SEPARATOR, trim($namespace, '\\')); |
|
102 | + return DIRECTORY_SEPARATOR . str_replace("\\", DIRECTORY_SEPARATOR, trim($namespace, '\\')); |
|
103 | 103 | } |
104 | 104 | } |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | public function testConvertPathToNamespaceData() |
39 | 39 | { |
40 | 40 | return [ |
41 | - ['/A/B/C', 'A\B\C'], |
|
42 | - ['A/B/C', 'A\B\C'], |
|
43 | - ['A/B/C', 'A\B\C'], |
|
44 | - ['A/B/C.php', 'A\B\C'], |
|
41 | + ['/A/B/C', 'A\B\C'], |
|
42 | + ['A/B/C', 'A\B\C'], |
|
43 | + ['A/B/C', 'A\B\C'], |
|
44 | + ['A/B/C.php', 'A\B\C'], |
|
45 | 45 | ]; |
46 | 46 | } |
47 | 47 | |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | public function testConvertNamespaceToPathData() |
62 | 62 | { |
63 | 63 | return [ |
64 | - ['A\B\C', '/A/B/C'], |
|
65 | - ['\A\B\C\\', '/A/B/C'], |
|
66 | - ['A\B\C\\', '/A/B/C'], |
|
64 | + ['A\B\C', '/A/B/C'], |
|
65 | + ['\A\B\C\\', '/A/B/C'], |
|
66 | + ['A\B\C\\', '/A/B/C'], |
|
67 | 67 | ]; |
68 | 68 | } |
69 | 69 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | public function testGetClasses() |
12 | 12 | { |
13 | 13 | $service = $this->getServiceInstance('\Commands'); |
14 | - $service->getClassLoader()->addPsr4('\\Robo\\', [realpath(__DIR__.'/../../src')]); |
|
14 | + $service->getClassLoader()->addPsr4('\\Robo\\', [realpath(__DIR__ . '/../../src')]); |
|
15 | 15 | |
16 | 16 | $classes = $service->getClasses(); |
17 | 17 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public function testGetFile() |
23 | 23 | { |
24 | 24 | $service = $this->getServiceInstance('\Commands'); |
25 | - $service->getClassLoader()->addPsr4('\\Robo\\', [realpath(__DIR__.'/../../src')]); |
|
25 | + $service->getClassLoader()->addPsr4('\\Robo\\', [realpath(__DIR__ . '/../../src')]); |
|
26 | 26 | |
27 | 27 | $actual = $service->getFile('\Robo\Commands\FirstCustomCommands'); |
28 | 28 | $this->assertStringEndsWith('tests/src/Commands/FirstCustomCommands.php', $actual); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
80 | - * @param $relativeNamespace |
|
80 | + * @param string $relativeNamespace |
|
81 | 81 | * |
82 | 82 | * @return \Robo\ClassDiscovery\RelativeNamespaceDiscovery |
83 | 83 | */ |
@@ -88,6 +88,10 @@ discard block |
||
88 | 88 | ->setClassLoader(new ClassLoader()); |
89 | 89 | } |
90 | 90 | |
91 | + /** |
|
92 | + * @param RelativeNamespaceDiscovery $object |
|
93 | + * @param string $method |
|
94 | + */ |
|
91 | 95 | protected function callProtected($object, $method, $args = []) |
92 | 96 | { |
93 | 97 | $r = new \ReflectionMethod($object, $method); |