Compare commits

...
Author SHA1 Message Date
Barry vd. Heuvel 2535f8e6ab Fix tests and CS 2024-02-07 21:44:48 +01:00
James Bhatta 16548fc878 Update README.md (#1451)
Fix intra page link for PHPDocs for models
2024-02-07 21:40:24 +01:00
Barry vd. Heuvel 872b470d9b Update CHANGELOG.md 2024-02-07 21:37:51 +01:00
7 changed files with 21 additions and 19 deletions
+1 -2
View File
@@ -8,9 +8,9 @@ All notable changes to this project will be documented in this file.
### Changed ### Changed
- Removed support for Laravel 8 and therefore for PHP < 8.0 [#1504 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1504) - Removed support for Laravel 8 and therefore for PHP < 8.0 [#1504 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1504)
### Added ### Added
- Add support for enum default arguments using enum cases. [#1464 / d8vjork](https://github.com/barryvdh/laravel-ide-helper/pull/1464) - Add support for enum default arguments using enum cases. [#1464 / d8vjork](https://github.com/barryvdh/laravel-ide-helper/pull/1464)
- Add support for real-time facades in the helper file. [#1455 / filipac](https://github.com/barryvdh/laravel-ide-helper/pull/1455)
2024-02-05, 2.14.0 2024-02-05, 2.14.0
------------------ ------------------
@@ -26,7 +26,6 @@ All notable changes to this project will be documented in this file.
### Added ### Added
- Add support for nikic/php-parser 5 (next to 4) [#1502 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1502) - Add support for nikic/php-parser 5 (next to 4) [#1502 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1502)
- Add support for `immutable_date:*` and `immutable_datetime:*` casts. [#1380 / thekonz](https://github.com/barryvdh/laravel-ide-helper/pull/1380) - Add support for `immutable_date:*` and `immutable_datetime:*` casts. [#1380 / thekonz](https://github.com/barryvdh/laravel-ide-helper/pull/1380)
- Add support for real-time facades in the helper file. [pending PR](#)
2023-02-04, 2.13.0 2023-02-04, 2.13.0
------------------ ------------------
+1 -1
View File
@@ -72,7 +72,7 @@ If for some reason you want manually control this:
_Check out [this Laracasts video](https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/15) for a quick introduction/explanation!_ _Check out [this Laracasts video](https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/15) for a quick introduction/explanation!_
- `php artisan ide-helper:generate` - [PHPDoc generation for Laravel Facades ](#automatic-phpdoc-generation-for-laravel-facades) - `php artisan ide-helper:generate` - [PHPDoc generation for Laravel Facades ](#automatic-phpdoc-generation-for-laravel-facades)
- `php artisan ide-helper:models` - [PHPDocs for models](#automatic-PHPDocs-for-models) - `php artisan ide-helper:models` - [PHPDocs for models](#automatic-phpdocs-for-models)
- `php artisan ide-helper:meta` - [PhpStorm Meta file](#phpstorm-meta-for-container-instances) - `php artisan ide-helper:meta` - [PhpStorm Meta file](#phpstorm-meta-for-container-instances)
+1 -1
View File
@@ -70,7 +70,7 @@ namespace <?= $namespace == '__root' ? '' : trim($namespace, '\\') ?> {
<?php endforeach; ?> <?php endforeach; ?>
<?php foreach($real_time_facades as $name): ?> <?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); ?> { namespace <?php echo implode('\\', $nested); ?> {
/** /**
* @mixin <?= str_replace('Facades', '', $name) ?> * @mixin <?= str_replace('Facades', '', $name) ?>
+9 -8
View File
@@ -158,9 +158,9 @@ class Generator
if ($facade == 'Illuminate\Support\Facades\Redis' && $name == 'Redis' && !class_exists('Predis\Client')) { if ($facade == 'Illuminate\Support\Facades\Redis' && $name == 'Redis' && !class_exists('Predis\Client')) {
continue; continue;
} }
// Skip the swoole // Skip the swoole
if ($facade == 'SwooleTW\Http\Server\Facades\Server' && $name == 'Server' && !class_exists('Swoole\Http\Server')) { if ($facade == 'SwooleTW\Http\Server\Facades\Server' && $name == 'Server' && !class_exists('Swoole\Http\Server')) {
continue; continue;
} }
@@ -183,7 +183,7 @@ class Generator
{ {
$facades = []; $facades = [];
$realTimeFacadeFiles = glob(storage_path('framework/cache/facade-*.php')); $realTimeFacadeFiles = glob(storage_path('framework/cache/facade-*.php'));
foreach($realTimeFacadeFiles as $file) { foreach ($realTimeFacadeFiles as $file) {
try { try {
$name = $this->getFullyQualifiedClassNameInFile($file); $name = $this->getFullyQualifiedClassNameInFile($file);
$facades[$name] = $name; $facades[$name] = $name;
@@ -195,10 +195,11 @@ class Generator
return $facades; return $facades;
} }
protected function getFullyQualifiedClassNameInFile(string $path) { protected function getFullyQualifiedClassNameInFile(string $path)
{
$contents = file_get_contents($path); $contents = file_get_contents($path);
$parsers = new Php7(new Emulative); $parsers = new Php7(new Emulative());
$parsed = collect($parsers->parse($contents) ?: []); $parsed = collect($parsers->parse($contents) ?: []);
@@ -206,14 +207,14 @@ class Generator
return $node instanceof Namespace_; return $node instanceof Namespace_;
}); });
if($namespace) { if ($namespace) {
$name = $namespace->name->toString(); $name = $namespace->name->toString();
$class = collect($namespace->stmts)->first(function ($node) { $class = collect($namespace->stmts)->first(function ($node) {
return $node instanceof Class_; return $node instanceof Class_;
}); });
if($class) { if ($class) {
$name .= '\\' . $class->name->toString(); $name .= '\\' . $class->name->toString();
} }
@@ -1,5 +1,7 @@
<?php <?php
declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Enums; namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Enums;
enum PostStatus enum PostStatus
@@ -9,4 +11,4 @@ enum PostStatus
case Unpublished; case Unpublished;
case Archived; case Archived;
} }
@@ -4,14 +4,14 @@ declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Models; 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 Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Enums\PostStatus;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class Post extends Model class Post extends Model
{ {
public function scopeHasStatus(Builder $query, ?PostStatus $status = PostStatus::Published) public function scopeHasStatus(Builder $query, ?PostStatus $status = PostStatus::Published)
{ {
// //
} }
} }
@@ -4,9 +4,9 @@ declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Models; 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 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 * 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) public function scopeHasStatus(Builder $query, ?PostStatus $status = PostStatus::Published)
{ {
// //
} }
} }