@@ -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,7 +14,7 @@ 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 | 20 | * @param FileCheckContractAlias $fileCheckContract |
@@ -70,6 +70,9 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | + /** |
|
| 74 | + * @param string $relativePath |
|
| 75 | + */ |
|
| 73 | 76 | private static function warn($currentNamespace, $relativePath) |
| 74 | 77 | { |
| 75 | 78 | $p = app(ErrorPrinter::class); |
@@ -91,6 +94,9 @@ discard block |
||
| 91 | 94 | return Str::startsWith($buffer, '<?php'); |
| 92 | 95 | } |
| 93 | 96 | |
| 97 | + /** |
|
| 98 | + * @param string $correctNamespace |
|
| 99 | + */ |
|
| 94 | 100 | protected static function doNamespaceCorrection($absFilePath, $currentNamespace, $correctNamespace) |
| 95 | 101 | { |
| 96 | 102 | event('laravel_microscope.namespace_fixing', get_defined_vars()); |
@@ -110,6 +116,10 @@ discard block |
||
| 110 | 116 | return $migrationDirs; |
| 111 | 117 | } |
| 112 | 118 | |
| 119 | + /** |
|
| 120 | + * @param FileCheckContractAlias $fileCheckContract |
|
| 121 | + * @param string $correctNamespace |
|
| 122 | + */ |
|
| 113 | 123 | private static function ask($fileCheckContract, $correctNamespace) |
| 114 | 124 | { |
| 115 | 125 | return $fileCheckContract->getOutput()->confirm("Do you want to change it to: {$correctNamespace}", true); |
@@ -29,6 +29,9 @@ discard block |
||
| 29 | 29 | ->link($absPath, $lineNumber)); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | + /** |
|
| 33 | + * @param string $errorTxt |
|
| 34 | + */ |
|
| 32 | 35 | public function route($path, $errorIt, $errorTxt, $absPath = null, $lineNumber = 0) |
| 33 | 36 | { |
| 34 | 37 | array_push($this->counts['route'], (new PendingError('route')) |
@@ -54,6 +57,10 @@ discard block |
||
| 54 | 57 | $this->pendError($absPath, $lineNumber, $relatedModel, 'badRelation', $header); |
| 55 | 58 | } |
| 56 | 59 | |
| 60 | + /** |
|
| 61 | + * @param string $key |
|
| 62 | + * @param string $header |
|
| 63 | + */ |
|
| 57 | 64 | public function pendError($path, $lineNumber, $absent, $key, $header) |
| 58 | 65 | { |
| 59 | 66 | array_push($this->counts[$key], (new PendingError($key)) |
@@ -98,6 +105,9 @@ discard block |
||
| 98 | 105 | ->link($absPath, $lineNumber)); |
| 99 | 106 | } |
| 100 | 107 | |
| 108 | + /** |
|
| 109 | + * @param integer $len |
|
| 110 | + */ |
|
| 101 | 111 | public function print($msg, $path = '| ', $len = null) |
| 102 | 112 | { |
| 103 | 113 | ! $len && $len = PendingError::$maxLength + 1; |
@@ -113,6 +123,9 @@ discard block |
||
| 113 | 123 | $this->printer->writeln($path.$msg.str_repeat(' ', $len).'|'); |
| 114 | 124 | } |
| 115 | 125 | |
| 126 | + /** |
|
| 127 | + * @param string $msg |
|
| 128 | + */ |
|
| 116 | 129 | public function printHeader($msg) |
| 117 | 130 | { |
| 118 | 131 | $this->print(''); |