mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-17 17:47:13 +00:00
Fix tests and CS
This commit is contained in:
@@ -70,7 +70,7 @@ namespace <?= $namespace == '__root' ? '' : trim($namespace, '\\') ?> {
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php foreach($real_time_facades as $name): ?>
|
||||
<?php $nested = explode('\\', str_replace('\\'.class_basename($name), '', $name)); ?>
|
||||
<?php $nested = explode('\\', str_replace('\\' . class_basename($name), '', $name)); ?>
|
||||
namespace <?php echo implode('\\', $nested); ?> {
|
||||
/**
|
||||
* @mixin <?= str_replace('Facades', '', $name) ?>
|
||||
|
||||
+9
-8
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Enums;
|
||||
|
||||
enum PostStatus
|
||||
@@ -9,4 +11,4 @@ enum PostStatus
|
||||
case Unpublished;
|
||||
|
||||
case Archived;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Enums\PostStatus;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Post extends Model
|
||||
{
|
||||
public function scopeHasStatus(Builder $query, ?PostStatus $status = PostStatus::Published)
|
||||
{
|
||||
//
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -4,9 +4,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Enums\PostStatus;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Models\Post
|
||||
@@ -167,6 +167,6 @@ class Post extends Model
|
||||
{
|
||||
public function scopeHasStatus(Builder $query, ?PostStatus $status = PostStatus::Published)
|
||||
{
|
||||
//
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user