Skip to content

Commit 2535f8e

Browse files
committed
Fix tests and CS
1 parent 16548fc commit 2535f8e

File tree

5 files changed

+19
-16
lines changed

5 files changed

+19
-16
lines changed

resources/views/helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public static function <?= $method->getName() ?>(<?= $method->getParamsWithDefau
7070
<?php endforeach; ?>
7171

7272
<?php foreach($real_time_facades as $name): ?>
73-
<?php $nested = explode('\\', str_replace('\\'.class_basename($name), '', $name)); ?>
73+
<?php $nested = explode('\\', str_replace('\\' . class_basename($name), '', $name)); ?>
7474
namespace <?php echo implode('\\', $nested); ?> {
7575
/**
7676
* @mixin <?= str_replace('Facades', '', $name) ?>

src/Generator.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ protected function getValidAliases()
158158
if ($facade == 'Illuminate\Support\Facades\Redis' && $name == 'Redis' && !class_exists('Predis\Client')) {
159159
continue;
160160
}
161-
162-
// Skip the swoole
163-
if ($facade == 'SwooleTW\Http\Server\Facades\Server' && $name == 'Server' && !class_exists('Swoole\Http\Server')) {
161+
162+
// Skip the swoole
163+
if ($facade == 'SwooleTW\Http\Server\Facades\Server' && $name == 'Server' && !class_exists('Swoole\Http\Server')) {
164164
continue;
165165
}
166166

@@ -183,7 +183,7 @@ protected function getRealTimeFacades()
183183
{
184184
$facades = [];
185185
$realTimeFacadeFiles = glob(storage_path('framework/cache/facade-*.php'));
186-
foreach($realTimeFacadeFiles as $file) {
186+
foreach ($realTimeFacadeFiles as $file) {
187187
try {
188188
$name = $this->getFullyQualifiedClassNameInFile($file);
189189
$facades[$name] = $name;
@@ -195,25 +195,26 @@ protected function getRealTimeFacades()
195195
return $facades;
196196
}
197197

198-
protected function getFullyQualifiedClassNameInFile(string $path) {
198+
protected function getFullyQualifiedClassNameInFile(string $path)
199+
{
199200
$contents = file_get_contents($path);
200201

201-
$parsers = new Php7(new Emulative);
202+
$parsers = new Php7(new Emulative());
202203

203204
$parsed = collect($parsers->parse($contents) ?: []);
204205

205206
$namespace = $parsed->first(function ($node) {
206207
return $node instanceof Namespace_;
207208
});
208209

209-
if($namespace) {
210+
if ($namespace) {
210211
$name = $namespace->name->toString();
211212

212213
$class = collect($namespace->stmts)->first(function ($node) {
213214
return $node instanceof Class_;
214215
});
215216

216-
if($class) {
217+
if ($class) {
217218
$name .= '\\' . $class->name->toString();
218219
}
219220

tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Enums/PostStatus.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Enums;
46

57
enum PostStatus
@@ -9,4 +11,4 @@ enum PostStatus
911
case Unpublished;
1012

1113
case Archived;
12-
}
14+
}

tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Models/Post.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Models;
66

7-
use Illuminate\Database\Eloquent\Model;
8-
use Illuminate\Database\Eloquent\Builder;
97
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Enums\PostStatus;
8+
use Illuminate\Database\Eloquent\Builder;
9+
use Illuminate\Database\Eloquent\Model;
1010

1111
class Post extends Model
1212
{
1313
public function scopeHasStatus(Builder $query, ?PostStatus $status = PostStatus::Published)
1414
{
15-
//
15+
//
1616
}
1717
}

tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Models;
66

7-
use Illuminate\Database\Eloquent\Model;
8-
use Illuminate\Database\Eloquent\Builder;
97
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Enums\PostStatus;
8+
use Illuminate\Database\Eloquent\Builder;
9+
use Illuminate\Database\Eloquent\Model;
1010

1111
/**
1212
* Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Models\Post
@@ -167,6 +167,6 @@ class Post extends Model
167167
{
168168
public function scopeHasStatus(Builder $query, ?PostStatus $status = PostStatus::Published)
169169
{
170-
//
170+
//
171171
}
172172
}

0 commit comments

Comments
 (0)