@@ -53,6 +53,10 @@ discard block |
||
53 | 53 | $this->pendError($absPath, $lineNumber, $relatedModel, 'badRelation', $header); |
54 | 54 | } |
55 | 55 | |
56 | + /** |
|
57 | + * @param string $key |
|
58 | + * @param string $header |
|
59 | + */ |
|
56 | 60 | public function pendError($path, $lineNumber, $absent, $key, $header) |
57 | 61 | { |
58 | 62 | array_push($this->counts[$key], (new PendingError($key)) |
@@ -89,6 +93,9 @@ discard block |
||
89 | 93 | ->link($absPath, $lineNumber)); |
90 | 94 | } |
91 | 95 | |
96 | + /** |
|
97 | + * @param integer $len |
|
98 | + */ |
|
92 | 99 | public function print($msg, $path = '| ', $len = null) |
93 | 100 | { |
94 | 101 | ! $len && $len = PendingError::$maxLength + 1; |
@@ -104,6 +111,9 @@ discard block |
||
104 | 111 | $this->printer->writeln($path.$msg.str_repeat(' ', $len).'|'); |
105 | 112 | } |
106 | 113 | |
114 | + /** |
|
115 | + * @param string $msg |
|
116 | + */ |
|
107 | 117 | public function printHeader($msg) |
108 | 118 | { |
109 | 119 | $this->print(''); |
@@ -4,9 +4,9 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Console\Command; |
6 | 6 | use Illuminate\Support\Composer; |
7 | -use Imanghafoori\LaravelMicroscope\CheckNamespaces; |
|
8 | -use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
|
9 | 7 | use Imanghafoori\LaravelMicroscope\Analyzers\ComposerJson; |
8 | +use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
|
9 | +use Imanghafoori\LaravelMicroscope\CheckNamespaces; |
|
10 | 10 | use Imanghafoori\LaravelMicroscope\Contracts\FileCheckContract; |
11 | 11 | use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
12 | 12 | use Imanghafoori\LaravelMicroscope\Traits\LogsErrors; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param ErrorPrinter $errorPrinter |
39 | 39 | * |
40 | - * @return mixed |
|
40 | + * @return integer |
|
41 | 41 | */ |
42 | 42 | public function handle(ErrorPrinter $errorPrinter) |
43 | 43 | { |
@@ -57,6 +57,9 @@ discard block |
||
57 | 57 | return app(ErrorPrinter::class)->hasErrors() ? 1 : 0; |
58 | 58 | } |
59 | 59 | |
60 | + /** |
|
61 | + * @param ErrorPrinter $errorPrinter |
|
62 | + */ |
|
60 | 63 | private function composerDumpIfNeeded($errorPrinter) |
61 | 64 | { |
62 | 65 | if ($errorPrinter->counts['badNamespace']) { |
@@ -16,6 +16,9 @@ discard block |
||
16 | 16 | return [$nextToken, $i]; |
17 | 17 | } |
18 | 18 | |
19 | + /** |
|
20 | + * @param string[] $tokenType |
|
21 | + */ |
|
19 | 22 | public static function forwardTo($tokens, $i, $tokenType) |
20 | 23 | { |
21 | 24 | $i++; |
@@ -46,6 +49,9 @@ discard block |
||
46 | 49 | return ($tokens[0][0] == T_CONSTANT_ENCAPSED_STRING) && ($nextToken !== '.'); |
47 | 50 | } |
48 | 51 | |
52 | + /** |
|
53 | + * @param string $funcName |
|
54 | + */ |
|
49 | 55 | public static function isGlobalCall($funcName, &$tokens, $i) |
50 | 56 | { |
51 | 57 | $expectedTokens = [ |
@@ -80,6 +86,9 @@ discard block |
||
80 | 86 | return self::checkTokens($expectedTokens, $tokens, $i); |
81 | 87 | } |
82 | 88 | |
89 | + /** |
|
90 | + * @param string $methodName |
|
91 | + */ |
|
83 | 92 | public static function isMethodCallOnThis($methodName, &$tokens, $i) |
84 | 93 | { |
85 | 94 | $expectedTokens = [ |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Imanghafoori\LaravelMicroscope\Refactors; |
4 | 4 | |
5 | -use Imanghafoori\LaravelMicroscope\Analyzers\Refactor; |
|
6 | 5 | use Imanghafoori\LaravelMicroscope\Analyzers\FunctionCall; |
6 | +use Imanghafoori\LaravelMicroscope\Analyzers\Refactor; |
|
7 | 7 | |
8 | 8 | class EarlyReturns |
9 | 9 | { |
@@ -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]; |
@@ -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; |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Imanghafoori\LaravelMicroscope\Refactors; |
4 | 4 | |
5 | -use Imanghafoori\LaravelMicroscope\Analyzers\Ifs; |
|
6 | 5 | use Imanghafoori\LaravelMicroscope\Analyzers\FunctionCall; |
6 | +use Imanghafoori\LaravelMicroscope\Analyzers\Ifs; |
|
7 | 7 | |
8 | 8 | class SyntaxNormalizer |
9 | 9 | { |
@@ -58,6 +58,9 @@ |
||
58 | 58 | return $stringOutput; |
59 | 59 | } |
60 | 60 | |
61 | + /** |
|
62 | + * @param \Closure $refactor |
|
63 | + */ |
|
61 | 64 | private static function recursiveRefactor($tokens, $refactor) |
62 | 65 | { |
63 | 66 | $i = $changes = 0; |
@@ -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\CheckPsr4 $command |
|
21 | 21 | * |
22 | 22 | * @return void |
23 | 23 | */ |
@@ -72,6 +72,9 @@ discard block |
||
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | + /** |
|
76 | + * @param string $relativePath |
|
77 | + */ |
|
75 | 78 | private static function warn($currentNamespace, $relativePath) |
76 | 79 | { |
77 | 80 | $p = app(ErrorPrinter::class); |
@@ -93,6 +96,9 @@ discard block |
||
93 | 96 | return Str::startsWith($buffer, '<?php'); |
94 | 97 | } |
95 | 98 | |
99 | + /** |
|
100 | + * @param string $correctNamespace |
|
101 | + */ |
|
96 | 102 | protected static function doNamespaceCorrection($absFilePath, $currentNamespace, $correctNamespace) |
97 | 103 | { |
98 | 104 | event('laravel_microscope.namespace_fixing', get_defined_vars()); |
@@ -100,6 +106,9 @@ discard block |
||
100 | 106 | event('laravel_microscope.namespace_fixed', get_defined_vars()); |
101 | 107 | } |
102 | 108 | |
109 | + /** |
|
110 | + * @param string $correctNamespace |
|
111 | + */ |
|
103 | 112 | private static function ask($command, $correctNamespace) |
104 | 113 | { |
105 | 114 | return $command->getOutput()->confirm('Do you want to change it to: '.$correctNamespace, true); |
@@ -4,10 +4,10 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Support\Str; |
6 | 6 | use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
7 | -use Imanghafoori\LaravelMicroscope\LaravelPaths\MigrationPaths; |
|
8 | 7 | use Imanghafoori\LaravelMicroscope\Analyzers\GetClassProperties; |
9 | 8 | use Imanghafoori\LaravelMicroscope\Analyzers\NamespaceCorrector; |
10 | 9 | use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
10 | +use Imanghafoori\LaravelMicroscope\LaravelPaths\MigrationPaths; |
|
11 | 11 | |
12 | 12 | class CheckNamespaces |
13 | 13 | { |
@@ -26,6 +26,9 @@ |
||
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | + /** |
|
30 | + * @param string $msg |
|
31 | + */ |
|
29 | 32 | public static function warnDumping($msg) |
30 | 33 | { |
31 | 34 | $p = resolve(ErrorPrinter::class)->printer; |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Imanghafoori\LaravelMicroscope; |
4 | 4 | |
5 | -use Illuminate\Support\Str; |
|
6 | 5 | use Illuminate\Support\Composer; |
6 | +use Illuminate\Support\Str; |
|
7 | 7 | use Imanghafoori\LaravelMicroscope\Analyzers\GetClassProperties; |
8 | 8 | use Imanghafoori\LaravelMicroscope\Analyzers\ParseUseStatement; |
9 | 9 | use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |