Use forked ContextFactory (#1643)

* Use forked ContextFactory

* composer fix-style

* Trim slashes

---------

Co-authored-by: laravel-ide-helper <[email protected]>
This commit is contained in:
Barry vd. Heuvel
2024-12-30 12:03:45 +01:00
committed by GitHub
co-authored by laravel-ide-helper
parent 791ba555f4
commit e509790805
2 changed files with 6 additions and 5 deletions
+2 -3
View File
@@ -22,14 +22,13 @@
"require": {
"php": "^8.2",
"ext-json": "*",
"barryvdh/reflection-docblock": "^2.2",
"barryvdh/reflection-docblock": "^2.3",
"composer/class-map-generator": "^1.0",
"illuminate/console": "^11.15",
"illuminate/database": "^11.15",
"illuminate/filesystem": "^11.15",
"illuminate/support": "^11.15",
"nikic/php-parser": "^4.18 || ^5",
"phpdocumentor/type-resolver": "^1.1.0"
"nikic/php-parser": "^4.18 || ^5"
},
"require-dev": {
"ext-pdo_sqlite": "*",
+4 -2
View File
@@ -16,6 +16,7 @@ use Barryvdh\LaravelIdeHelper\Generator;
use Barryvdh\LaravelIdeHelper\Parsers\PhpDocReturnTypeParser;
use Barryvdh\Reflection\DocBlock;
use Barryvdh\Reflection\DocBlock\Context;
use Barryvdh\Reflection\DocBlock\ContextFactory;
use Barryvdh\Reflection\DocBlock\Serializer as DocBlockSerializer;
use Barryvdh\Reflection\DocBlock\Tag;
use Composer\ClassMapGenerator\ClassMapGenerator;
@@ -49,7 +50,6 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Illuminate\View\Factory as ViewFactory;
use phpDocumentor\Reflection\Types\ContextFactory;
use ReflectionClass;
use ReflectionNamedType;
use ReflectionObject;
@@ -1571,7 +1571,9 @@ class ModelsCommand extends Command
*/
protected function getUsedClassNames(ReflectionClass $reflection): array
{
$namespaceAliases = array_flip((new ContextFactory())->createFromReflector($reflection)->getNamespaceAliases());
$namespaceAliases = array_flip(array_map(function ($alias) {
return ltrim($alias, '\\');
}, (new ContextFactory())->createFromReflector($reflection)->getNamespaceAliases()));
$namespaceAliases[$reflection->getName()] = $reflection->getShortName();
return $namespaceAliases;