@@ -3,13 +3,13 @@ |
||
3 | 3 | namespace Imanghafoori\LaravelMicroscope\Commands; |
4 | 4 | |
5 | 5 | use Illuminate\Console\Command; |
6 | -use Imanghafoori\LaravelMicroscope\Analyzers\Ifs; |
|
6 | +use Imanghafoori\LaravelMicroscope\Analyzers\ComposerJson; |
|
7 | 7 | use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
8 | -use Imanghafoori\LaravelMicroscope\SpyClasses\RoutePaths; |
|
9 | 8 | use Imanghafoori\LaravelMicroscope\Analyzers\FunctionCall; |
10 | -use Imanghafoori\LaravelMicroscope\Analyzers\ComposerJson; |
|
9 | +use Imanghafoori\LaravelMicroscope\Analyzers\Ifs; |
|
11 | 10 | use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
12 | 11 | use Imanghafoori\LaravelMicroscope\ErrorTypes\CompactCall; |
12 | +use Imanghafoori\LaravelMicroscope\SpyClasses\RoutePaths; |
|
13 | 13 | |
14 | 14 | class CheckCompact extends Command |
15 | 15 | { |
@@ -3,9 +3,9 @@ |
||
3 | 3 | namespace Imanghafoori\LaravelMicroscope\Commands; |
4 | 4 | |
5 | 5 | use Illuminate\Console\Command; |
6 | +use Imanghafoori\LaravelMicroscope\Analyzers\ComposerJson; |
|
6 | 7 | use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
7 | 8 | use Imanghafoori\LaravelMicroscope\Analyzers\Refactor; |
8 | -use Imanghafoori\LaravelMicroscope\Analyzers\ComposerJson; |
|
9 | 9 | use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
10 | 10 | |
11 | 11 | class CheckEarlyReturns extends Command |
@@ -56,6 +56,9 @@ discard block |
||
56 | 56 | return app(ErrorPrinter::class)->hasErrors() ? 1 : 0; |
57 | 57 | } |
58 | 58 | |
59 | + /** |
|
60 | + * @param integer $tries |
|
61 | + */ |
|
59 | 62 | private function fix($filePath, $tokens, $tries) |
60 | 63 | { |
61 | 64 | Refactor::saveTokens($filePath, $tokens, $this->option('test')); |
@@ -73,6 +76,9 @@ discard block |
||
73 | 76 | return [$fixes, $tokens]; |
74 | 77 | } |
75 | 78 | |
79 | + /** |
|
80 | + * @param integer $fixed |
|
81 | + */ |
|
76 | 82 | private function printFinalMsg($fixed) |
77 | 83 | { |
78 | 84 | if ($fixed > 0) { |
@@ -4,14 +4,14 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Console\Command; |
6 | 6 | use Illuminate\Support\Facades\View; |
7 | -use Imanghafoori\LaravelMicroscope\BladeFiles; |
|
8 | -use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
|
9 | -use Imanghafoori\LaravelMicroscope\ErrorTypes\BladeFile; |
|
10 | -use Imanghafoori\LaravelMicroscope\SpyClasses\RoutePaths; |
|
11 | 7 | use Imanghafoori\LaravelMicroscope\Analyzers\ComposerJson; |
8 | +use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
|
12 | 9 | use Imanghafoori\LaravelMicroscope\Analyzers\FunctionCall; |
13 | -use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
|
10 | +use Imanghafoori\LaravelMicroscope\BladeFiles; |
|
14 | 11 | use Imanghafoori\LaravelMicroscope\Checks\CheckViewFilesExistence; |
12 | +use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
|
13 | +use Imanghafoori\LaravelMicroscope\ErrorTypes\BladeFile; |
|
14 | +use Imanghafoori\LaravelMicroscope\SpyClasses\RoutePaths; |
|
15 | 15 | |
16 | 16 | class CheckViews extends Command |
17 | 17 | { |
@@ -4,18 +4,18 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Console\Command; |
6 | 6 | use Illuminate\Support\Composer; |
7 | -use Symfony\Component\Finder\Finder; |
|
8 | 7 | use Illuminate\Support\Facades\View; |
9 | -use Imanghafoori\LaravelMicroscope\CheckNamespaces; |
|
10 | -use Imanghafoori\LaravelMicroscope\FileReaders\Paths; |
|
11 | -use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
|
12 | -use Imanghafoori\LaravelMicroscope\SpyClasses\RoutePaths; |
|
13 | 8 | use Imanghafoori\LaravelMicroscope\Analyzers\ComposerJson; |
9 | +use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
|
10 | +use Imanghafoori\LaravelMicroscope\CheckNamespaces; |
|
14 | 11 | use Imanghafoori\LaravelMicroscope\Contracts\FileCheckContract; |
15 | 12 | use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
13 | +use Imanghafoori\LaravelMicroscope\FileReaders\Paths; |
|
14 | +use Imanghafoori\LaravelMicroscope\LaravelPaths\MigrationPaths; |
|
15 | +use Imanghafoori\LaravelMicroscope\SpyClasses\RoutePaths; |
|
16 | 16 | use Imanghafoori\LaravelMicroscope\Traits\LogsErrors; |
17 | 17 | use Imanghafoori\LaravelMicroscope\Traits\ScansFiles; |
18 | -use Imanghafoori\LaravelMicroscope\LaravelPaths\MigrationPaths; |
|
18 | +use Symfony\Component\Finder\Finder; |
|
19 | 19 | |
20 | 20 | class CheckPsr4 extends Command implements FileCheckContract |
21 | 21 | { |
@@ -4,11 +4,11 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Support\Str; |
6 | 6 | use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
7 | -use Imanghafoori\LaravelMicroscope\LaravelPaths\MigrationPaths; |
|
8 | -use Imanghafoori\LaravelMicroscope\ErrorReporters\PendingError; |
|
9 | 7 | use Imanghafoori\LaravelMicroscope\Analyzers\GetClassProperties; |
10 | 8 | use Imanghafoori\LaravelMicroscope\Analyzers\NamespaceCorrector; |
11 | 9 | use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
10 | +use Imanghafoori\LaravelMicroscope\ErrorReporters\PendingError; |
|
11 | +use Imanghafoori\LaravelMicroscope\LaravelPaths\MigrationPaths; |
|
12 | 12 | |
13 | 13 | class CheckNamespaces |
14 | 14 | { |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @param iterable $paths |
21 | 21 | * @param $composerPath |
22 | 22 | * @param $composerNamespace |
23 | - * @param $command |
|
23 | + * @param Commands\CheckPsr4 $command |
|
24 | 24 | * |
25 | 25 | * @return void |
26 | 26 | */ |
@@ -83,6 +83,9 @@ discard block |
||
83 | 83 | app(ErrorPrinter::class)->errorsList['total'] = 0; |
84 | 84 | } |
85 | 85 | |
86 | + /** |
|
87 | + * @param string $relativePath |
|
88 | + */ |
|
86 | 89 | private static function warn($currentNamespace, $relativePath) |
87 | 90 | { |
88 | 91 | /** |
@@ -110,6 +113,9 @@ discard block |
||
110 | 113 | return Str::startsWith($buffer, '<?php'); |
111 | 114 | } |
112 | 115 | |
116 | + /** |
|
117 | + * @param string $correctNamespace |
|
118 | + */ |
|
113 | 119 | protected static function doNamespaceCorrection($absFilePath, $currentNamespace, $correctNamespace) |
114 | 120 | { |
115 | 121 | event('laravel_microscope.namespace_fixing', get_defined_vars()); |
@@ -117,6 +123,9 @@ discard block |
||
117 | 123 | event('laravel_microscope.namespace_fixed', get_defined_vars()); |
118 | 124 | } |
119 | 125 | |
126 | + /** |
|
127 | + * @param string $correctNamespace |
|
128 | + */ |
|
120 | 129 | private static function ask($command, $correctNamespace) |
121 | 130 | { |
122 | 131 | return $command->getOutput()->confirm('Do you want to change it to: '.$correctNamespace, true); |
@@ -2,13 +2,13 @@ |
||
2 | 2 | |
3 | 3 | namespace Imanghafoori\LaravelMicroscope\ErrorReporters; |
4 | 4 | |
5 | -use Illuminate\Support\Str; |
|
6 | 5 | use Illuminate\Support\Facades\Event; |
7 | -use Imanghafoori\LaravelMicroscope\ErrorTypes\ddFound; |
|
8 | -use Imanghafoori\LaravelMicroscope\ErrorTypes\EnvFound; |
|
6 | +use Illuminate\Support\Str; |
|
9 | 7 | use Imanghafoori\LaravelMicroscope\ErrorTypes\BladeFile; |
10 | 8 | use Imanghafoori\LaravelMicroscope\ErrorTypes\CompactCall; |
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 | { |
@@ -2,13 +2,13 @@ |
||
2 | 2 | |
3 | 3 | namespace Imanghafoori\LaravelMicroscope\SpyClasses; |
4 | 4 | |
5 | -use ReflectionFunction; |
|
6 | -use ReflectionException; |
|
7 | -use Illuminate\Support\Str; |
|
8 | 5 | use Illuminate\Events\Dispatcher; |
6 | +use Illuminate\Support\Str; |
|
9 | 7 | use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
10 | 8 | use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
11 | 9 | use Imanghafoori\LaravelMicroscope\ErrorReporters\PendingError; |
10 | +use ReflectionException; |
|
11 | +use ReflectionFunction; |
|
12 | 12 | |
13 | 13 | class SpyDispatcher extends Dispatcher |
14 | 14 | { |
@@ -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 { |
@@ -3,8 +3,8 @@ |
||
3 | 3 | namespace Imanghafoori\LaravelMicroscope; |
4 | 4 | |
5 | 5 | use Illuminate\Support\Str; |
6 | -use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
|
7 | 6 | use Imanghafoori\LaravelMicroscope\Analyzers\ComposerJson; |
7 | +use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
|
8 | 8 | |
9 | 9 | class Psr4Classes |
10 | 10 | { |
@@ -47,6 +47,10 @@ discard block |
||
47 | 47 | $this->pendError($absPath, $lineNumber, $relatedModel, 'badRelation', $header); |
48 | 48 | } |
49 | 49 | |
50 | + /** |
|
51 | + * @param string $key |
|
52 | + * @param string $header |
|
53 | + */ |
|
50 | 54 | public function pendError($path, $lineNumber, $absent, $key, $header) |
51 | 55 | { |
52 | 56 | ($this->errorsList[$key][] = (new PendingError($key)) |
@@ -64,6 +68,11 @@ discard block |
||
64 | 68 | ->link($absPath, $lineNumber)); |
65 | 69 | } |
66 | 70 | |
71 | + /** |
|
72 | + * @param string $absent |
|
73 | + * @param string $key |
|
74 | + * @param string $header |
|
75 | + */ |
|
67 | 76 | public function simplePendError($path, $lineNumber, $absent, $key, $header) |
68 | 77 | { |
69 | 78 | ($this->errorsList[$key][] = (new PendingError($key)) |
@@ -150,6 +159,9 @@ discard block |
||
150 | 159 | ->link($absPath, $lineNumber)); |
151 | 160 | } |
152 | 161 | |
162 | + /** |
|
163 | + * @param integer $len |
|
164 | + */ |
|
153 | 165 | public function print($msg, $path = '| ', $len = null) |
154 | 166 | { |
155 | 167 | ! $len && $len = PendingError::$maxLength + 1; |
@@ -165,6 +177,9 @@ discard block |
||
165 | 177 | $this->printer->writeln($path.$msg.str_repeat(' ', $len).'|'); |
166 | 178 | } |
167 | 179 | |
180 | + /** |
|
181 | + * @param string $msg |
|
182 | + */ |
|
168 | 183 | public function printHeader($msg) |
169 | 184 | { |
170 | 185 | $number = ++$this->errorsList['total']; |
@@ -223,6 +238,9 @@ discard block |
||
223 | 238 | } |
224 | 239 | } |
225 | 240 | |
241 | + /** |
|
242 | + * @param string $key |
|
243 | + */ |
|
226 | 244 | public function getCount($key) |
227 | 245 | { |
228 | 246 | return count($this->errorsList[$key] ?? []); |