@@ -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; |
@@ -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,12 +2,12 @@ |
||
2 | 2 | |
3 | 3 | namespace Imanghafoori\LaravelMicroscope; |
4 | 4 | |
5 | -use Illuminate\Support\Str; |
|
6 | 5 | use Illuminate\Support\Composer; |
7 | -use Imanghafoori\LaravelMicroscope\Analyzers\ReplaceLine; |
|
6 | +use Illuminate\Support\Str; |
|
8 | 7 | use Imanghafoori\LaravelMicroscope\Analyzers\ComposerJson; |
9 | 8 | use Imanghafoori\LaravelMicroscope\Analyzers\GetClassProperties; |
10 | 9 | use Imanghafoori\LaravelMicroscope\Analyzers\ParseUseStatement; |
10 | +use Imanghafoori\LaravelMicroscope\Analyzers\ReplaceLine; |
|
11 | 11 | use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
12 | 12 | |
13 | 13 | class CheckClasses |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Routing\Controller; |
6 | 6 | use Imanghafoori\LaravelMicroscope\Analyzers\ClassMethods; |
7 | -use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
|
8 | 7 | use Imanghafoori\LaravelMicroscope\Analyzers\NamespaceCorrector; |
8 | +use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
|
9 | 9 | |
10 | 10 | class RoutelessActions |
11 | 11 | { |
@@ -40,6 +40,9 @@ discard block |
||
40 | 40 | return $namespace.'\\'.$className; |
41 | 41 | } |
42 | 42 | |
43 | + /** |
|
44 | + * @param string $fullNamespace |
|
45 | + */ |
|
43 | 46 | protected function isLaravelController($fullNamespace) |
44 | 47 | { |
45 | 48 | try { |
@@ -58,6 +61,9 @@ discard block |
||
58 | 61 | return $fullNamespace; |
59 | 62 | } |
60 | 63 | |
64 | + /** |
|
65 | + * @param string $fullNamespace |
|
66 | + */ |
|
61 | 67 | protected function findOrphanActions($tokens, $fullNamespace) |
62 | 68 | { |
63 | 69 | $class = ClassMethods::read($tokens); |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Imanghafoori\LaravelMicroscope\Checks; |
4 | 4 | |
5 | -use Imanghafoori\LaravelMicroscope\Analyzers\Refactor; |
|
6 | 5 | use Imanghafoori\LaravelMicroscope\Analyzers\ClassMethods; |
6 | +use Imanghafoori\LaravelMicroscope\Analyzers\Refactor; |
|
7 | 7 | |
8 | 8 | class ActionsComments extends RoutelessActions |
9 | 9 | { |
@@ -28,6 +28,9 @@ discard block |
||
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | + /** |
|
32 | + * @param string $fullNamespace |
|
33 | + */ |
|
31 | 34 | protected 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 function getMsg($methods, $route) |
77 | 83 | { |
78 | 84 | $msg = '/**'."\n"; |
@@ -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 |