diff --git a/src/Checks/CheckViewFilesExistence.php b/src/Checks/CheckViewFilesExistence.php index 8b3a5a37..88652909 100644 --- a/src/Checks/CheckViewFilesExistence.php +++ b/src/Checks/CheckViewFilesExistence.php @@ -17,8 +17,8 @@ public static function check($tokens, $absPath) } $viewName = \trim($tokens[$i + 4][1], '\'\"'); + CheckView::$checkedCallsNum++; if (! View::exists($viewName)) { - CheckViews::$checkedCallsNum++; self::error($tokens, $absPath, $i); } $i = $i + 5; diff --git a/src/Commands/CheckViews.php b/src/Commands/CheckViews.php index c05ed271..f1500b15 100644 --- a/src/Commands/CheckViews.php +++ b/src/Commands/CheckViews.php @@ -12,10 +12,6 @@ class CheckViews extends Command { - public static $checkedCallsNum = 0; - - public static $skippedCallsNum = 0; - protected $signature = 'check:views {--detailed : Show files being checked} {--f|file=} {--d|folder=}'; protected $description = 'Checks the validity of blade files'; @@ -33,7 +29,7 @@ public function handle(ErrorPrinter $errorPrinter) ForPsr4LoadedClasses::check([CheckView::class], [], $fileName, $folder); $this->checkBladeFiles(); - $this->getOutput()->writeln(' - '.self::$checkedCallsNum.' view references were checked to exist. ('.self::$skippedCallsNum.' skipped)'); + $this->getOutput()->writeln(' - '.CheckView::$checkedCallsNum.' view references were checked to exist. ('.CheckView::$skippedCallsNum.' skipped)'); event('microscope.finished.checks', [$this]); return $errorPrinter->hasErrors() ? 1 : 0; diff --git a/src/LaravelMicroscopeServiceProvider.php b/src/LaravelMicroscopeServiceProvider.php index 37c47f20..d5498814 100644 --- a/src/LaravelMicroscopeServiceProvider.php +++ b/src/LaravelMicroscopeServiceProvider.php @@ -13,6 +13,7 @@ use Illuminate\Support\Str; use Illuminate\View\View; use Imanghafoori\LaravelMicroscope\Checks\CheckClassReferences; +use Imanghafoori\LaravelMicroscope\Checks\CheckView; use Imanghafoori\LaravelMicroscope\Commands\CheckViews; use Imanghafoori\LaravelMicroscope\ErrorReporters\ConsolePrinterInstaller; use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; @@ -212,7 +213,8 @@ private function registerCompiler() private function resetCountersOnFinish() { Event::listen('microscope.finished.checks', function () { - CheckViews::$checkedCallsNum = 0; + CheckView::$checkedCallsNum = 0; + CheckView::$skippedCallsNum = 0; CheckClassReferences::$refCount = 0; ForPsr4LoadedClasses::$checkedFilesNum = 0; });