From 2535f8e6ab78a233f444a6bd26da8fecb12a93cb Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Wed, 7 Feb 2024 21:44:48 +0100 Subject: [PATCH] Fix tests and CS --- resources/views/helper.php | 2 +- src/Generator.php | 17 +++++++++-------- .../Enums/PostStatus.php | 4 +++- .../Models/Post.php | 6 +++--- .../__snapshots__/Test__test__1.php | 6 +++--- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/resources/views/helper.php b/resources/views/helper.php index 26a9abc..9479a7e 100644 --- a/resources/views/helper.php +++ b/resources/views/helper.php @@ -70,7 +70,7 @@ namespace { - + namespace { /** * @mixin diff --git a/src/Generator.php b/src/Generator.php index 0c7acc6..a509958 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -158,9 +158,9 @@ class Generator if ($facade == 'Illuminate\Support\Facades\Redis' && $name == 'Redis' && !class_exists('Predis\Client')) { continue; } - - // Skip the swoole - if ($facade == 'SwooleTW\Http\Server\Facades\Server' && $name == 'Server' && !class_exists('Swoole\Http\Server')) { + + // Skip the swoole + if ($facade == 'SwooleTW\Http\Server\Facades\Server' && $name == 'Server' && !class_exists('Swoole\Http\Server')) { continue; } @@ -183,7 +183,7 @@ class Generator { $facades = []; $realTimeFacadeFiles = glob(storage_path('framework/cache/facade-*.php')); - foreach($realTimeFacadeFiles as $file) { + foreach ($realTimeFacadeFiles as $file) { try { $name = $this->getFullyQualifiedClassNameInFile($file); $facades[$name] = $name; @@ -195,10 +195,11 @@ class Generator return $facades; } - protected function getFullyQualifiedClassNameInFile(string $path) { + protected function getFullyQualifiedClassNameInFile(string $path) + { $contents = file_get_contents($path); - $parsers = new Php7(new Emulative); + $parsers = new Php7(new Emulative()); $parsed = collect($parsers->parse($contents) ?: []); @@ -206,14 +207,14 @@ class Generator return $node instanceof Namespace_; }); - if($namespace) { + if ($namespace) { $name = $namespace->name->toString(); $class = collect($namespace->stmts)->first(function ($node) { return $node instanceof Class_; }); - if($class) { + if ($class) { $name .= '\\' . $class->name->toString(); } diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Enums/PostStatus.php b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Enums/PostStatus.php index afe6b9b..8a69af9 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Enums/PostStatus.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Enums/PostStatus.php @@ -1,5 +1,7 @@