Skip to content

Commit 9413c40

Browse files
committed
Bug fix for view counts
1 parent 9d3f533 commit 9413c40

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/Checks/CheckViewFilesExistence.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public static function check($tokens, $absPath)
1717
}
1818

1919
$viewName = \trim($tokens[$i + 4][1], '\'\"');
20+
CheckView::$checkedCallsNum++;
2021
if (! View::exists($viewName)) {
21-
CheckViews::$checkedCallsNum++;
2222
self::error($tokens, $absPath, $i);
2323
}
2424
$i = $i + 5;

src/Commands/CheckViews.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212

1313
class CheckViews extends Command
1414
{
15-
public static $checkedCallsNum = 0;
16-
17-
public static $skippedCallsNum = 0;
18-
1915
protected $signature = 'check:views {--detailed : Show files being checked} {--f|file=} {--d|folder=}';
2016

2117
protected $description = 'Checks the validity of blade files';
@@ -33,7 +29,7 @@ public function handle(ErrorPrinter $errorPrinter)
3329
ForPsr4LoadedClasses::check([CheckView::class], [], $fileName, $folder);
3430
$this->checkBladeFiles();
3531

36-
$this->getOutput()->writeln(' - '.self::$checkedCallsNum.' view references were checked to exist. ('.self::$skippedCallsNum.' skipped)');
32+
$this->getOutput()->writeln(' - '.CheckView::$checkedCallsNum.' view references were checked to exist. ('.CheckView::$skippedCallsNum.' skipped)');
3733
event('microscope.finished.checks', [$this]);
3834

3935
return $errorPrinter->hasErrors() ? 1 : 0;

src/LaravelMicroscopeServiceProvider.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Illuminate\Support\Str;
1414
use Illuminate\View\View;
1515
use Imanghafoori\LaravelMicroscope\Checks\CheckClassReferences;
16+
use Imanghafoori\LaravelMicroscope\Checks\CheckView;
1617
use Imanghafoori\LaravelMicroscope\Commands\CheckViews;
1718
use Imanghafoori\LaravelMicroscope\ErrorReporters\ConsolePrinterInstaller;
1819
use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter;
@@ -212,7 +213,8 @@ private function registerCompiler()
212213
private function resetCountersOnFinish()
213214
{
214215
Event::listen('microscope.finished.checks', function () {
215-
CheckViews::$checkedCallsNum = 0;
216+
CheckView::$checkedCallsNum = 0;
217+
CheckView::$skippedCallsNum = 0;
216218
CheckClassReferences::$refCount = 0;
217219
ForPsr4LoadedClasses::$checkedFilesNum = 0;
218220
});

0 commit comments

Comments
 (0)