@@ -20,6 +20,10 @@ |
||
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | + /** |
|
24 | + * @param integer $elseCount |
|
25 | + * @param integer $ifBody |
|
26 | + */ |
|
23 | 27 | private static function shouldBeFlipped($elseCount, $ifBody) |
24 | 28 | { |
25 | 29 | $ifIsLonger = ($elseCount + 10) < $ifBody; |
@@ -71,6 +71,9 @@ |
||
71 | 71 | return [$tokens, $changes]; |
72 | 72 | } |
73 | 73 | |
74 | + /** |
|
75 | + * @return string |
|
76 | + */ |
|
74 | 77 | private static function getKeyword($token) |
75 | 78 | { |
76 | 79 | return self::scopeKeywords[$token]; |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Imanghafoori\LaravelMicroscope\Refactors; |
4 | 4 | |
5 | -use Imanghafoori\LaravelMicroscope\Analyzers\FunctionCall; |
|
6 | 5 | use Imanghafoori\LaravelMicroscope\Analyzers\Refactor; |
7 | 6 | use Imanghafoori\LaravelMicroscope\Analyzers\TokenManager; |
8 | 7 |
@@ -59,6 +59,9 @@ discard block |
||
59 | 59 | return class_exists($eventName, false) ? $this->addOriginInterfaceListeners($eventName, $listeners) : $listeners; |
60 | 60 | } |
61 | 61 | |
62 | + /** |
|
63 | + * @param string $string |
|
64 | + */ |
|
62 | 65 | private function error($string) |
63 | 66 | { |
64 | 67 | $len = strlen($string); |
@@ -95,6 +98,9 @@ discard block |
||
95 | 98 | } |
96 | 99 | } |
97 | 100 | |
101 | + /** |
|
102 | + * @return string |
|
103 | + */ |
|
98 | 104 | private function stringify($event) |
99 | 105 | { |
100 | 106 | return is_object($event) ? get_class($event) : $event; |
@@ -116,6 +122,9 @@ discard block |
||
116 | 122 | return 'The method of '.$at.' is not callable as an event listener for "'.$e.'" event'; |
117 | 123 | } |
118 | 124 | |
125 | + /** |
|
126 | + * @return string |
|
127 | + */ |
|
119 | 128 | protected function getTypeHintedClass($listenerObj, $methodName) |
120 | 129 | { |
121 | 130 | try { |
@@ -141,6 +150,9 @@ discard block |
||
141 | 150 | return $listeners; |
142 | 151 | } |
143 | 152 | |
153 | + /** |
|
154 | + * @param \Closure $listener |
|
155 | + */ |
|
144 | 156 | private function stringifyClosure($listener) |
145 | 157 | { |
146 | 158 | try { |
@@ -28,6 +28,9 @@ discard block |
||
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | + /** |
|
32 | + * @param string $fullNamespace |
|
33 | + */ |
|
31 | 34 | protected static function checkActions($tokens, $fullNamespace, $path) |
32 | 35 | { |
33 | 36 | $class = ClassMethods::read($tokens); |
@@ -73,6 +76,9 @@ discard block |
||
73 | 76 | return $routelessActions; |
74 | 77 | } |
75 | 78 | |
79 | + /** |
|
80 | + * @param \Illuminate\Routing\Route $route |
|
81 | + */ |
|
76 | 82 | protected static function getMsg($methods, $route) |
77 | 83 | { |
78 | 84 | $msg = '/**'."\n"; |
@@ -72,6 +72,9 @@ discard block |
||
72 | 72 | return $tokens; |
73 | 73 | } |
74 | 74 | |
75 | + /** |
|
76 | + * @param string $name |
|
77 | + */ |
|
75 | 78 | public static function find($name) |
76 | 79 | { |
77 | 80 | if (self::hasHintInformation($name = \trim($name))) { |
@@ -88,6 +91,9 @@ discard block |
||
88 | 91 | }, ['blade.php']); |
89 | 92 | } |
90 | 93 | |
94 | + /** |
|
95 | + * @param string $name |
|
96 | + */ |
|
91 | 97 | protected static function findNamespacedView($name) |
92 | 98 | { |
93 | 99 | [$namespace, $view] = self::parseNamespaceSegments($name); |
@@ -122,11 +128,17 @@ discard block |
||
122 | 128 | } |
123 | 129 | } |
124 | 130 | |
131 | + /** |
|
132 | + * @param string $name |
|
133 | + */ |
|
125 | 134 | public static function hasHintInformation($name) |
126 | 135 | { |
127 | 136 | return strpos($name, '::') > 0; |
128 | 137 | } |
129 | 138 | |
139 | + /** |
|
140 | + * @param string $message |
|
141 | + */ |
|
130 | 142 | public static function forceFilePutContents($filepath, $message) |
131 | 143 | { |
132 | 144 | try { |
@@ -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('---------------------------------------------------'); |
@@ -6,9 +6,9 @@ |
||
6 | 6 | use Illuminate\Support\Str; |
7 | 7 | use Imanghafoori\LaravelMicroscope\ErrorTypes\BladeFile; |
8 | 8 | use Imanghafoori\LaravelMicroscope\ErrorTypes\CompactCall; |
9 | -use Imanghafoori\LaravelMicroscope\ErrorTypes\ddFound; |
|
10 | 9 | use Imanghafoori\LaravelMicroscope\ErrorTypes\EnvFound; |
11 | 10 | use Imanghafoori\LaravelMicroscope\ErrorTypes\RouteDefinitionConflict; |
11 | +use Imanghafoori\LaravelMicroscope\ErrorTypes\ddFound; |
|
12 | 12 | |
13 | 13 | class ConsolePrinterInstaller |
14 | 14 | { |
@@ -45,6 +45,9 @@ discard block |
||
45 | 45 | $errorPrinter->printTime(); |
46 | 46 | } |
47 | 47 | |
48 | + /** |
|
49 | + * @param string $commandType |
|
50 | + */ |
|
48 | 51 | protected static function getKey($commandType) |
49 | 52 | { |
50 | 53 | return "__microscope__$commandType-count"; |
@@ -115,6 +118,10 @@ discard block |
||
115 | 118 | }); |
116 | 119 | } |
117 | 120 | |
121 | + /** |
|
122 | + * @param string $commandType |
|
123 | + * @param integer $errorCount |
|
124 | + */ |
|
118 | 125 | protected static function printErrorCount($lastTimeCount, $commandType, $errorCount) |
119 | 126 | { |
120 | 127 | $lastTimeError = $commandType.' errors, compared to the last run.'; |
@@ -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 | */ |
@@ -69,6 +69,9 @@ discard block |
||
69 | 69 | return $path; |
70 | 70 | } |
71 | 71 | |
72 | + /** |
|
73 | + * @param string $name |
|
74 | + */ |
|
72 | 75 | private static function ask($command, $name) |
73 | 76 | { |
74 | 77 | return $command->getOutput()->confirm('Do you want to generate a service provider: '.$name, true); |
@@ -83,6 +86,9 @@ discard block |
||
83 | 86 | \in_array(T_DOUBLE_ARROW, [$tokens[$i + 1][0], $tokens[$i + 2][0]]); |
84 | 87 | } |
85 | 88 | |
89 | + /** |
|
90 | + * @param string $providerPath |
|
91 | + */ |
|
86 | 92 | private static function addToProvidersArray($providerPath) |
87 | 93 | { |
88 | 94 | $tokens = token_get_all(file_get_contents(config_path('app.php'))); |
@@ -107,6 +113,11 @@ discard block |
||
107 | 113 | return $tokens; |
108 | 114 | } |
109 | 115 | |
116 | + /** |
|
117 | + * @param \Symfony\Component\Finder\SplFileInfo $classFilePath |
|
118 | + * @param string $namespace |
|
119 | + * @param string $prefix |
|
120 | + */ |
|
110 | 121 | protected static function generateFolderStructure($classFilePath, $namespace, $prefix) |
111 | 122 | { |
112 | 123 | $_basePath = $classFilePath->getPath().DIRECTORY_SEPARATOR; |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace Imanghafoori\LaravelMicroscope; |
4 | 4 | |
5 | 5 | use Illuminate\Support\Str; |
6 | -use Imanghafoori\LaravelMicroscope\Analyzers\FunctionCall; |
|
7 | 6 | use Imanghafoori\LaravelMicroscope\Analyzers\NamespaceCorrector; |
8 | 7 | use Imanghafoori\LaravelMicroscope\Analyzers\Refactor; |
9 | 8 | use Imanghafoori\LaravelMicroscope\LaravelPaths\FilePath; |
@@ -63,6 +63,9 @@ |
||
63 | 63 | $this->warn(PHP_EOL.$tries.' fixes applied to: '.class_basename($filePath)); |
64 | 64 | } |
65 | 65 | |
66 | + /** |
|
67 | + * @param integer $fixed |
|
68 | + */ |
|
66 | 69 | private function printFinalMsg($fixed) |
67 | 70 | { |
68 | 71 | if ($fixed > 0) { |