Compare commits

..
Author SHA1 Message Date
laravel-ide-helper 4c2f68f14a composer fix-style 2025-01-08 10:00:25 +00:00
Barry vd. Heuvel a11dd14ee5 Check if macro is valid 2025-01-08 10:59:45 +01:00
5 changed files with 4 additions and 54 deletions
-14
View File
@@ -1,19 +1,5 @@
# 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
-1
View File
@@ -123,7 +123,6 @@ return [
'helper_files' => [
base_path() . '/vendor/laravel/framework/src/Illuminate/Support/helpers.php',
base_path() . '/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php',
],
/*
+2 -13
View File
@@ -233,12 +233,7 @@ class MetaCommand extends Command
],
[
'class' => ['\Illuminate\Support\Facades\Route', '\Illuminate\Support\Facades\Auth', 'Illuminate\Foundation\Auth\Access\Authorizable'],
'method' => ['can', 'cannot', 'cant'],
'argumentSet' => 'auth',
],
[
'class' => ['Illuminate\Contracts\Auth\Access\Authorizable'],
'method' => ['can'],
'method' => ['can', 'cannot'],
'argumentSet' => 'auth',
],
[
@@ -313,13 +308,7 @@ class MetaCommand extends Command
{
if (!isset($this->templateCache[$name])) {
$file = __DIR__ . '/../../php-templates/' . basename($name) . '.php';
try {
$value = $this->files->requireOnce($file) ?: [];
} catch (\Throwable $e) {
$value = [];
$this->warn('Cannot load template for ' . $name . ': ' . $e->getMessage());
}
$value = $this->files->requireOnce($file) ?: [];
if (!$value instanceof Collection) {
$value = collect($value);
}
+1 -7
View File
@@ -819,16 +819,10 @@ class ModelsCommand extends Command
$relation === 'morphTo'
)
) {
$matches = [];
$returnType = $this->getReturnTypeFromDocBlock($reflection);
if ($returnType !== null) {
preg_match('/MorphTo<(.+?)(?:,|>)/i', $returnType, $matches);
}
// Model isn't specified because relation is polymorphic
$this->setProperty(
$method,
$matches[1] ?? $this->getClassNameInDestinationFile($model, Model::class) . '|\Eloquent',
$this->getClassNameInDestinationFile($model, Model::class) . '|\Eloquent',
true,
null,
$comment,
+1 -19
View File
@@ -80,7 +80,7 @@ class Generator
->with('namespaces_by_extends_ns', $this->getAliasesByExtendsNamespace())
->with('namespaces_by_alias_ns', $this->getAliasesByAliasNamespace())
->with('real_time_facades', $this->getRealTimeFacades())
->with('helpers', $this->detectHelpers())
->with('helpers', $this->helpers)
->with('include_fluent', $this->config->get('ide-helper.include_fluent', true))
->with('factories', $this->config->get('ide-helper.include_factory_builders') ? Factories::all() : [])
->render();
@@ -112,24 +112,6 @@ class Generator
->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()
{
$defaultUserModel = config('auth.providers.users.model', config('auth.model', 'App\User'));