@@ -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) |
@@ -53,14 +53,14 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -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 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | public function testGetClasses() |
| 14 | 14 | { |
| 15 | 15 | $classLoader = new ClassLoader(); |
| 16 | - $classLoader->addPsr4('\\Robo\\PluginTest\\', [realpath(__DIR__.'/../../plugins')]); |
|
| 16 | + $classLoader->addPsr4('\\Robo\\PluginTest\\', [realpath(__DIR__ . '/../../plugins')]); |
|
| 17 | 17 | $service = new RelativeNamespaceDiscovery($classLoader); |
| 18 | 18 | $service->setRelativeNamespace('Robo\Plugin'); |
| 19 | 19 | $classes = $service->getClasses(); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | public function testGetFile() |
| 26 | 26 | { |
| 27 | 27 | $classLoader = new ClassLoader(); |
| 28 | - $classLoader->addPsr4('\\Robo\\PluginTest\\', [realpath(__DIR__.'/../../plugins')]); |
|
| 28 | + $classLoader->addPsr4('\\Robo\\PluginTest\\', [realpath(__DIR__ . '/../../plugins')]); |
|
| 29 | 29 | $service = new RelativeNamespaceDiscovery($classLoader); |
| 30 | 30 | $service->setRelativeNamespace('Robo\Plugin'); |
| 31 | 31 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | public function __construct($roboClass = null, $roboFile = null) |
| 64 | 64 | { |
| 65 | 65 | // set the const as class properties to allow overwriting in child classes |
| 66 | - $this->roboClass = $roboClass ? $roboClass : self::ROBOCLASS ; |
|
| 66 | + $this->roboClass = $roboClass ? $roboClass : self::ROBOCLASS; |
|
| 67 | 67 | $this->roboFile = $roboFile ? $roboFile : self::ROBOFILE; |
| 68 | 68 | $this->dir = getcwd(); |
| 69 | 69 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | { |
| 240 | 240 | /** @var \Robo\ClassDiscovery\RelativeNamespaceDiscovery $discovery */ |
| 241 | 241 | $discovery = Robo::service('relativeNamespaceDiscovery'); |
| 242 | - $discovery->setRelativeNamespace($relativeNamespace.'\Commands'); |
|
| 242 | + $discovery->setRelativeNamespace($relativeNamespace . '\Commands'); |
|
| 243 | 243 | return $discovery->getClasses(); |
| 244 | 244 | } |
| 245 | 245 | |
@@ -412,9 +412,9 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | if (substr($argv[$pos], 0, 12) == '--load-from=') { |
| 414 | 414 | $this->dir = substr($argv[$pos], 12); |
| 415 | - } elseif (isset($argv[$pos +1])) { |
|
| 416 | - $this->dir = $argv[$pos +1]; |
|
| 417 | - unset($argv[$pos +1]); |
|
| 415 | + } elseif (isset($argv[$pos + 1])) { |
|
| 416 | + $this->dir = $argv[$pos + 1]; |
|
| 417 | + unset($argv[$pos + 1]); |
|
| 418 | 418 | } |
| 419 | 419 | unset($argv[$pos]); |
| 420 | 420 | // Make adjustments if '--load-from' points at a file. |
@@ -68,6 +68,9 @@ discard block |
||
| 68 | 68 | $this->dir = getcwd(); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | + /** |
|
| 72 | + * @param string $errorType |
|
| 73 | + */ |
|
| 71 | 74 | protected function errorCondition($msg, $errorType) |
| 72 | 75 | { |
| 73 | 76 | $this->errorConditions[$msg] = $errorType; |
@@ -115,7 +118,7 @@ discard block |
||
| 115 | 118 | } |
| 116 | 119 | |
| 117 | 120 | /** |
| 118 | - * @param array $argv |
|
| 121 | + * @param string[] $argv |
|
| 119 | 122 | * @param null|string $appName |
| 120 | 123 | * @param null|string $appVersion |
| 121 | 124 | * @param null|\Symfony\Component\Console\Output\OutputInterface $output |
@@ -138,7 +141,7 @@ discard block |
||
| 138 | 141 | * @param null|\Symfony\Component\Console\Input\InputInterface $input |
| 139 | 142 | * @param null|\Symfony\Component\Console\Output\OutputInterface $output |
| 140 | 143 | * @param null|\Robo\Application $app |
| 141 | - * @param array[] $commandFiles |
|
| 144 | + * @param null|string $commandFiles |
|
| 142 | 145 | * @param null|ClassLoader $classLoader |
| 143 | 146 | * |
| 144 | 147 | * @return int |
@@ -231,9 +234,9 @@ discard block |
||
| 231 | 234 | } |
| 232 | 235 | |
| 233 | 236 | /** |
| 234 | - * @param $relativeNamespace |
|
| 237 | + * @param string $relativeNamespace |
|
| 235 | 238 | * |
| 236 | - * @return array|string[] |
|
| 239 | + * @return string[] |
|
| 237 | 240 | */ |
| 238 | 241 | protected function discoverCommandClasses($relativeNamespace) |
| 239 | 242 | { |