mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 10:07:12 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
980a87e250 | ||
|
|
299a81b9bb | ||
|
|
06c1fab9b5 | ||
|
|
271682a2a6 | ||
|
|
bb1caed698 | ||
|
|
55268cd47a | ||
|
|
088968c3fc | ||
|
|
655e057626 | ||
|
|
c8d85a0d34 | ||
|
|
4c656cc71d | ||
|
|
0fe9774dfb |
@@ -1,5 +1,58 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v3.5.3 - 2025-01-08
|
||||||
|
|
||||||
|
### What's Changed
|
||||||
|
|
||||||
|
* Catch meta, tweak auth by @barryvdh in https://github.com/barryvdh/laravel-ide-helper/pull/1654
|
||||||
|
* Check if macro is valid by @barryvdh in https://github.com/barryvdh/laravel-ide-helper/pull/1655
|
||||||
|
* feat: use generics of return type to determine resulting models by @Bloemendaal in https://github.com/barryvdh/laravel-ide-helper/pull/1653
|
||||||
|
|
||||||
|
### New Contributors
|
||||||
|
|
||||||
|
* @Bloemendaal made their first contribution in https://github.com/barryvdh/laravel-ide-helper/pull/1653
|
||||||
|
|
||||||
|
**Full Changelog**: https://github.com/barryvdh/laravel-ide-helper/compare/v3.5.2...v3.5.3
|
||||||
|
|
||||||
|
## v3.5.2 - 2025-01-06
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
Fix empty/anonymous closure in meta command.
|
||||||
|
|
||||||
|
**Full Changelog**: https://github.com/barryvdh/laravel-ide-helper/compare/v3.5.1...v3.5.2
|
||||||
|
|
||||||
|
## v3.5.1 - 2025-01-06
|
||||||
|
|
||||||
|
### What's Changed
|
||||||
|
|
||||||
|
* Remove duplicate config, fix ->can() by @barryvdh in https://github.com/barryvdh/laravel-ide-helper/pull/1650
|
||||||
|
|
||||||
|
**Full Changelog**: https://github.com/barryvdh/laravel-ide-helper/compare/v3.5.0...v3.5.1
|
||||||
|
|
||||||
|
## v3.5.0 - 2025-01-06
|
||||||
|
|
||||||
|
### What's Changed
|
||||||
|
|
||||||
|
* Add phpstorm meta argument hints by @barryvdh in https://github.com/barryvdh/laravel-ide-helper/pull/1640
|
||||||
|
* Add meta override for user return types by @barryvdh in https://github.com/barryvdh/laravel-ide-helper/pull/1642
|
||||||
|
* Use forked ContextFactory by @barryvdh in https://github.com/barryvdh/laravel-ide-helper/pull/1643
|
||||||
|
* Remove php parser by @barryvdh in https://github.com/barryvdh/laravel-ide-helper/pull/1644
|
||||||
|
* Also add eloquent template tags from base class by @barryvdh in https://github.com/barryvdh/laravel-ide-helper/pull/1645
|
||||||
|
* Add more metadata by @barryvdh in https://github.com/barryvdh/laravel-ide-helper/pull/1646
|
||||||
|
* Fixed generating PHPDoc for methods with class templates by @chack1172 in https://github.com/barryvdh/laravel-ide-helper/pull/1647
|
||||||
|
* Feat guess macro types by @barryvdh in https://github.com/barryvdh/laravel-ide-helper/pull/1648
|
||||||
|
* Allow adding custom Macroable classes. by @mathieutu in https://github.com/barryvdh/laravel-ide-helper/pull/1629
|
||||||
|
* Add special `dev` to composer keywords by @jnoordsij in https://github.com/barryvdh/laravel-ide-helper/pull/1649
|
||||||
|
|
||||||
|
### New Contributors
|
||||||
|
|
||||||
|
* @chack1172 made their first contribution in https://github.com/barryvdh/laravel-ide-helper/pull/1647
|
||||||
|
* @mathieutu made their first contribution in https://github.com/barryvdh/laravel-ide-helper/pull/1629
|
||||||
|
* @jnoordsij made their first contribution in https://github.com/barryvdh/laravel-ide-helper/pull/1649
|
||||||
|
|
||||||
|
**Full Changelog**: https://github.com/barryvdh/laravel-ide-helper/compare/v3.4.0...v3.5.0
|
||||||
|
|
||||||
## v3.4.0 - 2024-12-29
|
## v3.4.0 - 2024-12-29
|
||||||
|
|
||||||
### What's Changed
|
### What's Changed
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ return [
|
|||||||
|
|
||||||
'helper_files' => [
|
'helper_files' => [
|
||||||
base_path() . '/vendor/laravel/framework/src/Illuminate/Support/helpers.php',
|
base_path() . '/vendor/laravel/framework/src/Illuminate/Support/helpers.php',
|
||||||
|
base_path() . '/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php',
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ return collect(Illuminate\Support\Facades\Gate::abilities())
|
|||||||
|
|
||||||
$policyClass = null;
|
$policyClass = null;
|
||||||
|
|
||||||
if (get_class($reflection->getClosureThis()) === Illuminate\Auth\Access\Gate::class) {
|
$closureThis = $reflection->getClosureThis();
|
||||||
|
if ($closureThis && get_class($closureThis) === Illuminate\Auth\Access\Gate::class) {
|
||||||
$vars = $reflection->getClosureUsedVariables();
|
$vars = $reflection->getClosureUsedVariables();
|
||||||
|
|
||||||
if (isset($vars['callback'])) {
|
if (isset($vars['callback'])) {
|
||||||
|
|||||||
+7
-1
@@ -403,9 +403,15 @@ class Alias
|
|||||||
$macros = isset($properties['macros']) ? $properties['macros'] : [];
|
$macros = isset($properties['macros']) ? $properties['macros'] : [];
|
||||||
foreach ($macros as $macro_name => $macro_func) {
|
foreach ($macros as $macro_name => $macro_func) {
|
||||||
if (!in_array($macro_name, $this->usedMethods)) {
|
if (!in_array($macro_name, $this->usedMethods)) {
|
||||||
|
try {
|
||||||
|
$method = $this->getMacroFunction($macro_func);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
// Invalid method, skip
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Add macros
|
// Add macros
|
||||||
$this->methods[] = new Macro(
|
$this->methods[] = new Macro(
|
||||||
$this->getMacroFunction($macro_func),
|
$method,
|
||||||
$this->alias,
|
$this->alias,
|
||||||
$reflection,
|
$reflection,
|
||||||
$macro_name,
|
$macro_name,
|
||||||
|
|||||||
@@ -232,18 +232,19 @@ class MetaCommand extends Command
|
|||||||
'argumentSet' => 'auth',
|
'argumentSet' => 'auth',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'class' => ['\Illuminate\Support\Facades\Route', '\Illuminate\Support\Facades\Auth'],
|
'class' => ['\Illuminate\Support\Facades\Route', '\Illuminate\Support\Facades\Auth', 'Illuminate\Foundation\Auth\Access\Authorizable'],
|
||||||
'method' => ['can', 'cannot'],
|
'method' => ['can', 'cannot', 'cant'],
|
||||||
'argumentSet' => 'auth',
|
'argumentSet' => 'auth',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'method' => 'config',
|
'class' => ['Illuminate\Contracts\Auth\Access\Authorizable'],
|
||||||
'argumentSet' => 'configs',
|
'method' => ['can'],
|
||||||
|
'argumentSet' => 'auth',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'class' => ['\Illuminate\Config\Repository', '\Illuminate\Support\Facades\Config'],
|
'class' => ['\Illuminate\Config\Repository', '\Illuminate\Support\Facades\Config'],
|
||||||
'method' => [
|
'method' => [
|
||||||
'get',
|
// 'get', // config() and Config::Get() are added with return type hints already
|
||||||
'getMany',
|
'getMany',
|
||||||
'set',
|
'set',
|
||||||
'string',
|
'string',
|
||||||
@@ -312,7 +313,13 @@ class MetaCommand extends Command
|
|||||||
{
|
{
|
||||||
if (!isset($this->templateCache[$name])) {
|
if (!isset($this->templateCache[$name])) {
|
||||||
$file = __DIR__ . '/../../php-templates/' . basename($name) . '.php';
|
$file = __DIR__ . '/../../php-templates/' . basename($name) . '.php';
|
||||||
|
try {
|
||||||
$value = $this->files->requireOnce($file) ?: [];
|
$value = $this->files->requireOnce($file) ?: [];
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
$value = [];
|
||||||
|
$this->warn('Cannot load template for ' . $name . ': ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
if (!$value instanceof Collection) {
|
if (!$value instanceof Collection) {
|
||||||
$value = collect($value);
|
$value = collect($value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -819,10 +819,16 @@ class ModelsCommand extends Command
|
|||||||
$relation === 'morphTo'
|
$relation === 'morphTo'
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
$matches = [];
|
||||||
|
$returnType = $this->getReturnTypeFromDocBlock($reflection);
|
||||||
|
if ($returnType !== null) {
|
||||||
|
preg_match('/MorphTo<(.+?)(?:,|>)/i', $returnType, $matches);
|
||||||
|
}
|
||||||
|
|
||||||
// Model isn't specified because relation is polymorphic
|
// Model isn't specified because relation is polymorphic
|
||||||
$this->setProperty(
|
$this->setProperty(
|
||||||
$method,
|
$method,
|
||||||
$this->getClassNameInDestinationFile($model, Model::class) . '|\Eloquent',
|
$matches[1] ?? $this->getClassNameInDestinationFile($model, Model::class) . '|\Eloquent',
|
||||||
true,
|
true,
|
||||||
null,
|
null,
|
||||||
$comment,
|
$comment,
|
||||||
|
|||||||
+19
-1
@@ -80,7 +80,7 @@ class Generator
|
|||||||
->with('namespaces_by_extends_ns', $this->getAliasesByExtendsNamespace())
|
->with('namespaces_by_extends_ns', $this->getAliasesByExtendsNamespace())
|
||||||
->with('namespaces_by_alias_ns', $this->getAliasesByAliasNamespace())
|
->with('namespaces_by_alias_ns', $this->getAliasesByAliasNamespace())
|
||||||
->with('real_time_facades', $this->getRealTimeFacades())
|
->with('real_time_facades', $this->getRealTimeFacades())
|
||||||
->with('helpers', $this->helpers)
|
->with('helpers', $this->detectHelpers())
|
||||||
->with('include_fluent', $this->config->get('ide-helper.include_fluent', true))
|
->with('include_fluent', $this->config->get('ide-helper.include_fluent', true))
|
||||||
->with('factories', $this->config->get('ide-helper.include_factory_builders') ? Factories::all() : [])
|
->with('factories', $this->config->get('ide-helper.include_factory_builders') ? Factories::all() : [])
|
||||||
->render();
|
->render();
|
||||||
@@ -112,6 +112,24 @@ class Generator
|
|||||||
->render();
|
->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function detectHelpers()
|
||||||
|
{
|
||||||
|
$helpers = $this->helpers;
|
||||||
|
|
||||||
|
$replacements = [
|
||||||
|
'($guard is null ? \Illuminate\Contracts\Auth\Factory : \Illuminate\Contracts\Auth\StatefulGuard)' => '\\Auth',
|
||||||
|
];
|
||||||
|
foreach ($replacements as $search => $replace) {
|
||||||
|
$helpers = Str::replace(
|
||||||
|
"@return {$search}",
|
||||||
|
"@return $replace|$search",
|
||||||
|
$helpers
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $helpers;
|
||||||
|
}
|
||||||
|
|
||||||
protected function detectDrivers()
|
protected function detectDrivers()
|
||||||
{
|
{
|
||||||
$defaultUserModel = config('auth.providers.users.model', config('auth.model', 'App\User'));
|
$defaultUserModel = config('auth.providers.users.model', config('auth.model', 'App\User'));
|
||||||
|
|||||||
Reference in New Issue
Block a user