@@ -45,6 +45,9 @@ discard block |
||
45 | 45 | return $tokens; |
46 | 46 | } |
47 | 47 | |
48 | + /** |
|
49 | + * @param string $name |
|
50 | + */ |
|
48 | 51 | public static function find($name) |
49 | 52 | { |
50 | 53 | if (self::hasHintInformation($name = trim($name))) { |
@@ -61,6 +64,9 @@ discard block |
||
61 | 64 | }, ['blade.php']); |
62 | 65 | } |
63 | 66 | |
67 | + /** |
|
68 | + * @param string $name |
|
69 | + */ |
|
64 | 70 | protected static function findNamespacedView($name) |
65 | 71 | { |
66 | 72 | [$namespace, $view] = self::parseNamespaceSegments($name); |
@@ -95,11 +101,17 @@ discard block |
||
95 | 101 | } |
96 | 102 | } |
97 | 103 | |
104 | + /** |
|
105 | + * @param string $name |
|
106 | + */ |
|
98 | 107 | public static function hasHintInformation($name) |
99 | 108 | { |
100 | 109 | return strpos($name, '::') > 0; |
101 | 110 | } |
102 | 111 | |
112 | + /** |
|
113 | + * @param string $message |
|
114 | + */ |
|
103 | 115 | public static function forceFilePutContents($filepath, $message){ |
104 | 116 | try { |
105 | 117 | $isInFolder = preg_match("/^(.*)\/([^\/]+)$/", $filepath, $filepathMatches); |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Imanghafoori\LaravelMicroscope\Checks; |
4 | 4 | |
5 | -use Illuminate\Support\Str; |
|
6 | 5 | use Illuminate\Support\Facades\View; |
6 | +use Illuminate\Support\Str; |
|
7 | 7 | use Imanghafoori\LaravelMicroscope\Analyzers\FunctionCall; |
8 | 8 | |
9 | 9 | class ExtractBladePartial |
@@ -2,21 +2,21 @@ |
||
2 | 2 | |
3 | 3 | namespace Imanghafoori\LaravelMicroscope; |
4 | 4 | |
5 | -use Illuminate\View\View; |
|
6 | -use Illuminate\Support\Str; |
|
5 | +use Illuminate\Contracts\Auth\Access\Gate as GateContract; |
|
6 | +use Illuminate\Contracts\Queue\Factory as QueueFactoryContract; |
|
7 | 7 | use Illuminate\Support\Facades\Event; |
8 | 8 | use Illuminate\Support\Facades\Route; |
9 | 9 | use Illuminate\Support\ServiceProvider; |
10 | +use Illuminate\Support\Str; |
|
11 | +use Illuminate\View\View; |
|
10 | 12 | use Imanghafoori\LaravelMicroscope\Commands; |
13 | +use Imanghafoori\LaravelMicroscope\ErrorReporters\ConsolePrinterInstaller; |
|
14 | +use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
|
15 | +use Imanghafoori\LaravelMicroscope\SpyClasses\SpyBladeCompiler; |
|
16 | +use Imanghafoori\LaravelMicroscope\SpyClasses\SpyDispatcher; |
|
11 | 17 | use Imanghafoori\LaravelMicroscope\SpyClasses\SpyGate; |
12 | 18 | use Imanghafoori\LaravelMicroscope\SpyClasses\SpyRouter; |
13 | 19 | use Imanghafoori\LaravelMicroscope\SpyClasses\ViewsData; |
14 | -use Illuminate\Contracts\Auth\Access\Gate as GateContract; |
|
15 | -use Imanghafoori\LaravelMicroscope\SpyClasses\SpyDispatcher; |
|
16 | -use Imanghafoori\LaravelMicroscope\SpyClasses\SpyBladeCompiler; |
|
17 | -use Illuminate\Contracts\Queue\Factory as QueueFactoryContract; |
|
18 | -use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
|
19 | -use Imanghafoori\LaravelMicroscope\ErrorReporters\ConsolePrinterInstaller; |
|
20 | 20 | |
21 | 21 | class LaravelMicroscopeServiceProvider extends ServiceProvider |
22 | 22 | { |
@@ -3,8 +3,8 @@ |
||
3 | 3 | namespace Imanghafoori\LaravelMicroscope\Commands; |
4 | 4 | |
5 | 5 | use Exception; |
6 | -use Illuminate\Support\Str; |
|
7 | 6 | use Illuminate\Console\Command; |
7 | +use Illuminate\Support\Str; |
|
8 | 8 | |
9 | 9 | class PrettyPrintRoutes extends Command |
10 | 10 | { |
@@ -56,6 +56,9 @@ discard block |
||
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | + /** |
|
60 | + * @param string $value |
|
61 | + */ |
|
59 | 62 | private function deduceRoute($value) |
60 | 63 | { |
61 | 64 | if (Str::containsAll($value, ['@', '\\'])) { |
@@ -79,6 +82,9 @@ discard block |
||
79 | 82 | } |
80 | 83 | } |
81 | 84 | |
85 | + /** |
|
86 | + * @param string $action |
|
87 | + */ |
|
82 | 88 | private function getMovableRoute($route, $methods, $action, $middlewares) |
83 | 89 | { |
84 | 90 | $nameSection = ($route->getName() ? ("->name('".$route->getName()."')") : ''); |
@@ -109,6 +115,9 @@ discard block |
||
109 | 115 | return $middlewares; |
110 | 116 | } |
111 | 117 | |
118 | + /** |
|
119 | + * @param Exception $e |
|
120 | + */ |
|
112 | 121 | private function handleRouteProblem($e) |
113 | 122 | { |
114 | 123 | $this->info('The route has some problem.'); |
@@ -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) { |
@@ -3,10 +3,10 @@ |
||
3 | 3 | namespace Imanghafoori\LaravelMicroscope\Commands; |
4 | 4 | |
5 | 5 | use Illuminate\Console\Command; |
6 | -use Imanghafoori\LaravelMicroscope\GenerateCode; |
|
7 | -use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
|
8 | 6 | use Imanghafoori\LaravelMicroscope\Analyzers\ComposerJson; |
7 | +use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
|
9 | 8 | use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
9 | +use Imanghafoori\LaravelMicroscope\GenerateCode; |
|
10 | 10 | |
11 | 11 | class CheckExpansions extends Command |
12 | 12 | { |
@@ -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 | { |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * Get all of the listeners and their corresponding events. |
18 | 18 | * |
19 | - * @param iterable $paths |
|
19 | + * @param \Symfony\Component\Finder\Finder $paths |
|
20 | 20 | * @param $composerPath |
21 | 21 | * @param $composerNamespace |
22 | - * @param $command |
|
22 | + * @param Commands\CheckPsr4 $command |
|
23 | 23 | * |
24 | 24 | * @return void |
25 | 25 | */ |
@@ -82,6 +82,9 @@ discard block |
||
82 | 82 | app(ErrorPrinter::class)->counts['total'] = 0; |
83 | 83 | } |
84 | 84 | |
85 | + /** |
|
86 | + * @param string $relativePath |
|
87 | + */ |
|
85 | 88 | private static function warn($currentNamespace, $relativePath) |
86 | 89 | { |
87 | 90 | /** |
@@ -106,6 +109,9 @@ discard block |
||
106 | 109 | return Str::startsWith($buffer, '<?php'); |
107 | 110 | } |
108 | 111 | |
112 | + /** |
|
113 | + * @param string $correctNamespace |
|
114 | + */ |
|
109 | 115 | protected static function doNamespaceCorrection($absFilePath, $currentNamespace, $correctNamespace) |
110 | 116 | { |
111 | 117 | event('laravel_microscope.namespace_fixing', get_defined_vars()); |
@@ -113,6 +119,9 @@ discard block |
||
113 | 119 | event('laravel_microscope.namespace_fixed', get_defined_vars()); |
114 | 120 | } |
115 | 121 | |
122 | + /** |
|
123 | + * @param string $correctNamespace |
|
124 | + */ |
|
116 | 125 | private static function ask($command, $correctNamespace) |
117 | 126 | { |
118 | 127 | return $command->getOutput()->confirm('Do you want to change it to: '.$correctNamespace, true); |
@@ -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 | { |
@@ -62,6 +62,10 @@ discard block |
||
62 | 62 | $this->pendError($absPath, $lineNumber, $relatedModel, 'badRelation', $header); |
63 | 63 | } |
64 | 64 | |
65 | + /** |
|
66 | + * @param string $key |
|
67 | + * @param string $header |
|
68 | + */ |
|
65 | 69 | public function pendError($path, $lineNumber, $absent, $key, $header) |
66 | 70 | { |
67 | 71 | array_push($this->counts[$key], (new PendingError($key)) |
@@ -79,6 +83,11 @@ discard block |
||
79 | 83 | ->link($absPath, $lineNumber)); |
80 | 84 | } |
81 | 85 | |
86 | + /** |
|
87 | + * @param string $absent |
|
88 | + * @param string $key |
|
89 | + * @param string $header |
|
90 | + */ |
|
82 | 91 | public function simplePendError($path, $lineNumber, $absent, $key, $header) |
83 | 92 | { |
84 | 93 | array_push($this->counts[$key], (new PendingError($key)) |
@@ -165,6 +174,9 @@ discard block |
||
165 | 174 | ->link($absPath, $lineNumber)); |
166 | 175 | } |
167 | 176 | |
177 | + /** |
|
178 | + * @param integer $len |
|
179 | + */ |
|
168 | 180 | public function print($msg, $path = '| ', $len = null) |
169 | 181 | { |
170 | 182 | ! $len && $len = PendingError::$maxLength + 1; |
@@ -180,6 +192,9 @@ discard block |
||
180 | 192 | $this->printer->writeln($path.$msg.str_repeat(' ', $len).'|'); |
181 | 193 | } |
182 | 194 | |
195 | + /** |
|
196 | + * @param string $msg |
|
197 | + */ |
|
183 | 198 | public function printHeader($msg) |
184 | 199 | { |
185 | 200 | $number = ++$this->counts['total']; |