@@ -108,6 +108,9 @@ |
||
| 108 | 108 | return $refactoredTokens; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | + /** |
|
| 112 | + * @param integer $i |
|
| 113 | + */ |
|
| 111 | 114 | private static function removeSemi(&$tokens, $i) |
| 112 | 115 | { |
| 113 | 116 | [$next, $u] = FunctionCall::getNextToken($tokens, $i); |
@@ -84,6 +84,10 @@ |
||
| 84 | 84 | return [$fixes, $tokens]; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | + /** |
|
| 88 | + * @param integer $fixed |
|
| 89 | + * @param integer $fixingFilesCount |
|
| 90 | + */ |
|
| 87 | 91 | private function printFinalMsg($fixed, $fixingFilesCount) |
| 88 | 92 | { |
| 89 | 93 | if ($fixed > 0) { |
@@ -59,6 +59,9 @@ |
||
| 59 | 59 | return $string; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | + /** |
|
| 63 | + * @param \Closure $refactor |
|
| 64 | + */ |
|
| 62 | 65 | private static function recursiveRefactor($tokens, $refactor) |
| 63 | 66 | { |
| 64 | 67 | $i = $changes = 0; |
@@ -37,6 +37,10 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | + /** |
|
| 41 | + * @param integer $level |
|
| 42 | + * @param integer $i |
|
| 43 | + */ |
|
| 40 | 44 | private static function openCurly($token, $level, $tokens, $i, $classFilePath) |
| 41 | 45 | { |
| 42 | 46 | if ($token == '{' && ! \in_array($tokens[$i - 1][0], [T_DOUBLE_COLON, T_OBJECT_OPERATOR])) { |
@@ -55,6 +59,11 @@ discard block |
||
| 55 | 59 | } |
| 56 | 60 | } |
| 57 | 61 | |
| 62 | + /** |
|
| 63 | + * @param integer $level |
|
| 64 | + * @param boolean $isInClass |
|
| 65 | + * @param integer $i |
|
| 66 | + */ |
|
| 58 | 67 | private static function writePublic($level, $token, $isInClass, $i, $tokens, $absolutePath) |
| 59 | 68 | { |
| 60 | 69 | if (($level != 1) || ($token[0] != T_FUNCTION) || ! $isInClass) { |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * Get all of the listeners and their corresponding events. |
| 20 | 20 | * |
| 21 | - * @param iterable $paths |
|
| 21 | + * @param \Symfony\Component\Finder\Finder $paths |
|
| 22 | 22 | * @param $composerPath |
| 23 | 23 | * @param $composerNamespace |
| 24 | - * @param $command |
|
| 24 | + * @param Commands\CheckPsr4 $command |
|
| 25 | 25 | * |
| 26 | 26 | * @return void |
| 27 | 27 | */ |
@@ -96,6 +96,9 @@ discard block |
||
| 96 | 96 | return Str::startsWith($buffer, '<?php'); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | + /** |
|
| 100 | + * @param string $correctNamespace |
|
| 101 | + */ |
|
| 99 | 102 | protected static function doNamespaceCorrection($absFilePath, $currentNamespace, $correctNamespace) |
| 100 | 103 | { |
| 101 | 104 | event('laravel_microscope.namespace_fixing', get_defined_vars()); |
@@ -103,6 +106,9 @@ discard block |
||
| 103 | 106 | event('laravel_microscope.namespace_fixed', get_defined_vars()); |
| 104 | 107 | } |
| 105 | 108 | |
| 109 | + /** |
|
| 110 | + * @param string $correctNamespace |
|
| 111 | + */ |
|
| 106 | 112 | private static function changedNamespaces($class, $currentNamespace, $correctNamespace) |
| 107 | 113 | { |
| 108 | 114 | $_currentClass = $currentNamespace.'\\'.$class; |
@@ -74,6 +74,9 @@ discard block |
||
| 74 | 74 | return $class; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | + /** |
|
| 78 | + * @param string $content |
|
| 79 | + */ |
|
| 77 | 80 | private static function requestIssue($content) |
| 78 | 81 | { |
| 79 | 82 | dump('(O_o) Well, It seems we had some problem parsing the contents of: (o_O)'); |
@@ -82,6 +85,9 @@ discard block |
||
| 82 | 85 | dump($content); |
| 83 | 86 | } |
| 84 | 87 | |
| 88 | + /** |
|
| 89 | + * @param integer $i |
|
| 90 | + */ |
|
| 85 | 91 | private static function findVisibility($tokens, $i) |
| 86 | 92 | { |
| 87 | 93 | $isStatic = $tokens[$i][0] === T_STATIC && $i -= 2; |
@@ -14,6 +14,9 @@ |
||
| 14 | 14 | return trim(implode('\\', $segments), '\\'); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | + /** |
|
| 18 | + * @param string $class1 |
|
| 19 | + */ |
|
| 17 | 20 | public static function haveSameNamespace($class1, $class2) |
| 18 | 21 | { |
| 19 | 22 | return self::getNamespaceFromFullClass($class1) == self::getNamespaceFromFullClass($class2); |
@@ -35,6 +35,9 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | + /** |
|
| 39 | + * @param \Illuminate\Routing\Route $route |
|
| 40 | + */ |
|
| 38 | 41 | private function writeIt($route, $filename) |
| 39 | 42 | { |
| 40 | 43 | try { |
@@ -57,6 +60,9 @@ discard block |
||
| 57 | 60 | } |
| 58 | 61 | } |
| 59 | 62 | |
| 63 | + /** |
|
| 64 | + * @param string $value |
|
| 65 | + */ |
|
| 60 | 66 | private function deduceRoute($value) |
| 61 | 67 | { |
| 62 | 68 | if (Str::containsAll($value, ['@', '\\'])) { |
@@ -68,6 +74,9 @@ discard block |
||
| 68 | 74 | return $route; |
| 69 | 75 | } |
| 70 | 76 | |
| 77 | + /** |
|
| 78 | + * @param \Illuminate\Routing\Route $route |
|
| 79 | + */ |
|
| 71 | 80 | private function printIt($route) |
| 72 | 81 | { |
| 73 | 82 | try { |
@@ -80,6 +89,10 @@ discard block |
||
| 80 | 89 | } |
| 81 | 90 | } |
| 82 | 91 | |
| 92 | + /** |
|
| 93 | + * @param string $action |
|
| 94 | + * @param string $middlewareSection |
|
| 95 | + */ |
|
| 83 | 96 | private function getMovableRoute($route, $methods, $action, $middlewareSection) |
| 84 | 97 | { |
| 85 | 98 | if ($action == '\Illuminate\Routing\ViewController::class') { |
@@ -117,6 +130,9 @@ discard block |
||
| 117 | 130 | return $middlewares ? '->middleware([' . $middlewares . '])' : ''; |
| 118 | 131 | } |
| 119 | 132 | |
| 133 | + /** |
|
| 134 | + * @param Exception $e |
|
| 135 | + */ |
|
| 120 | 136 | private function handleRouteProblem($e) |
| 121 | 137 | { |
| 122 | 138 | $this->info('The route has some problem.'); |
@@ -124,6 +140,9 @@ discard block |
||
| 124 | 140 | $this->info($e->getFile()); |
| 125 | 141 | } |
| 126 | 142 | |
| 143 | + /** |
|
| 144 | + * @param string $middlewares |
|
| 145 | + */ |
|
| 127 | 146 | private function prettyPrintInConsole($route, $middlewares) |
| 128 | 147 | { |
| 129 | 148 | $this->getOutput()->writeln('---------------------------------------------------'); |
@@ -14,10 +14,10 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * Get all of the listeners and their corresponding events. |
| 16 | 16 | * |
| 17 | - * @param iterable $paths |
|
| 17 | + * @param \Symfony\Component\Finder\Finder $paths |
|
| 18 | 18 | * @param $composerPath |
| 19 | 19 | * @param $composerNamespace |
| 20 | - * @param $command |
|
| 20 | + * @param Commands\CheckExpansions $command |
|
| 21 | 21 | * |
| 22 | 22 | * @return void |
| 23 | 23 | */ |
@@ -79,6 +79,9 @@ discard block |
||
| 79 | 79 | return $path; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | + /** |
|
| 83 | + * @param string $name |
|
| 84 | + */ |
|
| 82 | 85 | private static function ask($command, $name) |
| 83 | 86 | { |
| 84 | 87 | return $command->getOutput()->confirm('Do you want to generate a service provider: ' . $name, true); |
@@ -93,6 +96,9 @@ discard block |
||
| 93 | 96 | \in_array(T_DOUBLE_ARROW, [$tokens[$i + 1][0], $tokens[$i + 2][0]]); |
| 94 | 97 | } |
| 95 | 98 | |
| 99 | + /** |
|
| 100 | + * @param string $providerPath |
|
| 101 | + */ |
|
| 96 | 102 | private static function addToProvidersArray($providerPath) |
| 97 | 103 | { |
| 98 | 104 | $tokens = token_get_all(file_get_contents(config_path('app.php'))); |
@@ -117,6 +123,11 @@ discard block |
||
| 117 | 123 | return $tokens; |
| 118 | 124 | } |
| 119 | 125 | |
| 126 | + /** |
|
| 127 | + * @param \Symfony\Component\Finder\SplFileInfo $classFilePath |
|
| 128 | + * @param string $namespace |
|
| 129 | + * @param string $prefix |
|
| 130 | + */ |
|
| 120 | 131 | protected static function generateFolderStructure($classFilePath, $namespace, $prefix) |
| 121 | 132 | { |
| 122 | 133 | $_basePath = $classFilePath->getPath() . DIRECTORY_SEPARATOR; |
@@ -7,7 +7,6 @@ |
||
| 7 | 7 | use Imanghafoori\LaravelMicroscope\Analyzers\NamespaceCorrector; |
| 8 | 8 | use Imanghafoori\LaravelMicroscope\Analyzers\Refactor; |
| 9 | 9 | use Imanghafoori\LaravelMicroscope\LaravelPaths\FilePath; |
| 10 | -use Imanghafoori\LaravelMicroscope\Stubs\ServiceProviderStub; |
|
| 11 | 10 | |
| 12 | 11 | class GenerateCode |
| 13 | 12 | { |