mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-20 19:13:11 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c2f68f14a | ||
|
|
a11dd14ee5 |
@@ -20,7 +20,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php: [8.4, 8.3, 8.2]
|
php: [8.4, 8.3, 8.2]
|
||||||
laravel: [11.x, 12.x]
|
laravel: [^11.15]
|
||||||
|
|
||||||
name: P${{ matrix.php }} - Laravel${{ matrix.laravel }}
|
name: P${{ matrix.php }} - Laravel${{ matrix.laravel }}
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-22.04, windows-2019]
|
os: [ubuntu-22.04, windows-2019]
|
||||||
php: [8.4, 8.3, 8.2]
|
php: [8.4, 8.3, 8.2]
|
||||||
laravel: [~11.15, 12.x]
|
laravel: [^11.15]
|
||||||
stability: [prefer-lowest, prefer-stable]
|
stability: [prefer-lowest, prefer-stable]
|
||||||
steps:
|
steps:
|
||||||
- name: Set git to use LF
|
- name: Set git to use LF
|
||||||
|
|||||||
@@ -1,28 +1,5 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## v3.5.4 - 2025-01-14
|
|
||||||
|
|
||||||
### What's Changed
|
|
||||||
|
|
||||||
* Convert auth() helper to use Auth facade by @barryvdh in https://github.com/barryvdh/laravel-ide-helper/pull/1656
|
|
||||||
* Check if returnType from docblock is not null by @barryvdh in https://github.com/barryvdh/laravel-ide-helper/pull/1658
|
|
||||||
|
|
||||||
**Full Changelog**: https://github.com/barryvdh/laravel-ide-helper/compare/v3.5.3...v3.5.4
|
|
||||||
|
|
||||||
## 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
|
## v3.5.2 - 2025-01-06
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|||||||
+8
-8
@@ -25,19 +25,19 @@
|
|||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"barryvdh/reflection-docblock": "^2.3",
|
"barryvdh/reflection-docblock": "^2.3",
|
||||||
"composer/class-map-generator": "^1.0",
|
"composer/class-map-generator": "^1.0",
|
||||||
"illuminate/console": "^11.15 || ^12",
|
"illuminate/console": "^11.15",
|
||||||
"illuminate/database": "^11.15 || ^12",
|
"illuminate/database": "^11.15",
|
||||||
"illuminate/filesystem": "^11.15 || ^12",
|
"illuminate/filesystem": "^11.15",
|
||||||
"illuminate/support": "^11.15 || ^12"
|
"illuminate/support": "^11.15"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"ext-pdo_sqlite": "*",
|
"ext-pdo_sqlite": "*",
|
||||||
"friendsofphp/php-cs-fixer": "^3",
|
"friendsofphp/php-cs-fixer": "^3",
|
||||||
"illuminate/config": "^11.15 || ^12",
|
"illuminate/config": "^11.15",
|
||||||
"illuminate/view": "^11.15 || ^12",
|
"illuminate/view": "^11.15",
|
||||||
"mockery/mockery": "^1.4",
|
"mockery/mockery": "^1.4",
|
||||||
"orchestra/testbench": "^9.2 || ^10",
|
"orchestra/testbench": "^9.2",
|
||||||
"phpunit/phpunit": "^10.5 || ^11.5.3",
|
"phpunit/phpunit": "^10.5",
|
||||||
"spatie/phpunit-snapshot-assertions": "^4 || ^5",
|
"spatie/phpunit-snapshot-assertions": "^4 || ^5",
|
||||||
"vimeo/psalm": "^5.4",
|
"vimeo/psalm": "^5.4",
|
||||||
"vlucas/phpdotenv": "^5"
|
"vlucas/phpdotenv": "^5"
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ 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',
|
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ function vsCodeGetConfigValue($value, $key, $configPaths)
|
|||||||
$key = collect(explode('.', $key));
|
$key = collect(explode('.', $key));
|
||||||
$key->pop();
|
$key->pop();
|
||||||
$key = $key->implode('.');
|
$key = $key->implode('.');
|
||||||
$value = [];
|
$value = 'array(...)';
|
||||||
}
|
}
|
||||||
|
|
||||||
$nextKey = $keysToFind->shift();
|
$nextKey = $keysToFind->shift();
|
||||||
|
|||||||
@@ -233,12 +233,7 @@ class MetaCommand extends Command
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'class' => ['\Illuminate\Support\Facades\Route', '\Illuminate\Support\Facades\Auth', 'Illuminate\Foundation\Auth\Access\Authorizable'],
|
'class' => ['\Illuminate\Support\Facades\Route', '\Illuminate\Support\Facades\Auth', 'Illuminate\Foundation\Auth\Access\Authorizable'],
|
||||||
'method' => ['can', 'cannot', 'cant'],
|
'method' => ['can', 'cannot'],
|
||||||
'argumentSet' => 'auth',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'class' => ['Illuminate\Contracts\Auth\Access\Authorizable'],
|
|
||||||
'method' => ['can'],
|
|
||||||
'argumentSet' => 'auth',
|
'argumentSet' => 'auth',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -313,13 +308,7 @@ 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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -628,10 +628,6 @@ class ModelsCommand extends Command
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
// https://github.com/barryvdh/laravel-ide-helper/issues/1664
|
|
||||||
$reflections = array_filter($reflections, function (\ReflectionMethod $methodReflection) {
|
|
||||||
return !($methodReflection->getName() === 'getUseFactoryAttribute');
|
|
||||||
});
|
|
||||||
sort($reflections);
|
sort($reflections);
|
||||||
foreach ($reflections as $reflection) {
|
foreach ($reflections as $reflection) {
|
||||||
$type = $this->getReturnTypeFromReflection($reflection);
|
$type = $this->getReturnTypeFromReflection($reflection);
|
||||||
@@ -823,16 +819,10 @@ class ModelsCommand extends Command
|
|||||||
$relation === 'morphTo'
|
$relation === 'morphTo'
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
$matches = [];
|
|
||||||
$returnType = $this->getReturnTypeFromDocBlock($reflection);
|
|
||||||
if ($returnType !== null) {
|
|
||||||
preg_match('/MorphTo<(?:contravariant\s+)?(.+?)(?:,|>)/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,
|
||||||
$matches[1] ?? $this->getClassNameInDestinationFile($model, Model::class) . '|\Eloquent',
|
$this->getClassNameInDestinationFile($model, Model::class) . '|\Eloquent',
|
||||||
true,
|
true,
|
||||||
null,
|
null,
|
||||||
$comment,
|
$comment,
|
||||||
|
|||||||
+1
-19
@@ -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->detectHelpers())
|
->with('helpers', $this->helpers)
|
||||||
->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,24 +112,6 @@ 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