@@ -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 { |
@@ -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 |
@@ -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 | { |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * Get all of the listeners and their corresponding events. |
| 19 | 19 | * |
| 20 | - * @param iterable $paths |
|
| 20 | + * @param \Symfony\Component\Finder\Finder $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); |
@@ -4,11 +4,11 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Illuminate\Support\Str; |
| 6 | 6 | use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
| 7 | -use Imanghafoori\LaravelMicroscope\LaravelPaths\LaravelPaths; |
|
| 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\LaravelPaths; |
|
| 12 | 12 | |
| 13 | 13 | class CheckNamespaces |
| 14 | 14 | { |
@@ -28,6 +28,9 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | + /** |
|
| 32 | + * @param string $fullNamespace |
|
| 33 | + */ |
|
| 31 | 34 | protected static 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 static function getMsg($methods, $route) |
| 77 | 83 | { |
| 78 | 84 | $msg = '/**'."\n"; |
@@ -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 |
| 9 | 9 | { |
@@ -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\Traits\LogsErrors; |
|
| 11 | -use Imanghafoori\LaravelMicroscope\Traits\ScansFiles; |
|
| 12 | -use Imanghafoori\LaravelMicroscope\FileReaders\Paths; |
|
| 13 | -use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
|
| 14 | -use Imanghafoori\LaravelMicroscope\SpyClasses\RoutePaths; |
|
| 15 | 8 | use Imanghafoori\LaravelMicroscope\Analyzers\ComposerJson; |
| 16 | -use Imanghafoori\LaravelMicroscope\LaravelPaths\LaravelPaths; |
|
| 9 | +use Imanghafoori\LaravelMicroscope\Analyzers\FilePath; |
|
| 10 | +use Imanghafoori\LaravelMicroscope\CheckNamespaces; |
|
| 17 | 11 | use Imanghafoori\LaravelMicroscope\Contracts\FileCheckContract; |
| 18 | 12 | use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
| 13 | +use Imanghafoori\LaravelMicroscope\FileReaders\Paths; |
|
| 14 | +use Imanghafoori\LaravelMicroscope\LaravelPaths\LaravelPaths; |
|
| 15 | +use Imanghafoori\LaravelMicroscope\SpyClasses\RoutePaths; |
|
| 16 | +use Imanghafoori\LaravelMicroscope\Traits\LogsErrors; |
|
| 17 | +use Imanghafoori\LaravelMicroscope\Traits\ScansFiles; |
|
| 18 | +use Symfony\Component\Finder\Finder; |
|
| 19 | 19 | |
| 20 | 20 | class CheckPsr4 extends Command implements FileCheckContract |
| 21 | 21 | { |
@@ -16,6 +16,9 @@ discard block |
||
| 16 | 16 | return [$token, $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 = [ |
@@ -72,6 +72,9 @@ discard block |
||
| 72 | 72 | return $tokens; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | + /** |
|
| 76 | + * @param string $name |
|
| 77 | + */ |
|
| 75 | 78 | public static function find($name) |
| 76 | 79 | { |
| 77 | 80 | if (self::hasHintInformation($name = \trim($name))) { |
@@ -88,6 +91,9 @@ discard block |
||
| 88 | 91 | }, ['blade.php']); |
| 89 | 92 | } |
| 90 | 93 | |
| 94 | + /** |
|
| 95 | + * @param string $name |
|
| 96 | + */ |
|
| 91 | 97 | protected static function findNamespacedView($name) |
| 92 | 98 | { |
| 93 | 99 | [$namespace, $view] = self::parseNamespaceSegments($name); |
@@ -122,11 +128,17 @@ discard block |
||
| 122 | 128 | } |
| 123 | 129 | } |
| 124 | 130 | |
| 131 | + /** |
|
| 132 | + * @param string $name |
|
| 133 | + */ |
|
| 125 | 134 | public static function hasHintInformation($name) |
| 126 | 135 | { |
| 127 | 136 | return strpos($name, '::') > 0; |
| 128 | 137 | } |
| 129 | 138 | |
| 139 | + /** |
|
| 140 | + * @param string $message |
|
| 141 | + */ |
|
| 130 | 142 | public static function forceFilePutContents($filepath, $message){ |
| 131 | 143 | try { |
| 132 | 144 | $isInFolder = preg_match("/^(.*)\/([^\/]+)$/", $filepath, $filepathMatches); |
@@ -3,8 +3,8 @@ |
||
| 3 | 3 | namespace Imanghafoori\LaravelMicroscope\Checks; |
| 4 | 4 | |
| 5 | 5 | use Exception; |
| 6 | -use Illuminate\Support\Str; |
|
| 7 | 6 | use Illuminate\Support\Facades\View; |
| 7 | +use Illuminate\Support\Str; |
|
| 8 | 8 | use Imanghafoori\LaravelMicroscope\Analyzers\FunctionCall; |
| 9 | 9 | use InvalidArgumentException; |
| 10 | 10 | |