Skip to content

Commit e509790

Browse files
barryvdhlaravel-ide-helper
and
laravel-ide-helper
authored
Use forked ContextFactory (#1643)
* Use forked ContextFactory * composer fix-style * Trim slashes --------- Co-authored-by: laravel-ide-helper <[email protected]>
1 parent 791ba55 commit e509790

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

composer.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@
2222
"require": {
2323
"php": "^8.2",
2424
"ext-json": "*",
25-
"barryvdh/reflection-docblock": "^2.2",
25+
"barryvdh/reflection-docblock": "^2.3",
2626
"composer/class-map-generator": "^1.0",
2727
"illuminate/console": "^11.15",
2828
"illuminate/database": "^11.15",
2929
"illuminate/filesystem": "^11.15",
3030
"illuminate/support": "^11.15",
31-
"nikic/php-parser": "^4.18 || ^5",
32-
"phpdocumentor/type-resolver": "^1.1.0"
31+
"nikic/php-parser": "^4.18 || ^5"
3332
},
3433
"require-dev": {
3534
"ext-pdo_sqlite": "*",

src/Console/ModelsCommand.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Barryvdh\LaravelIdeHelper\Parsers\PhpDocReturnTypeParser;
1717
use Barryvdh\Reflection\DocBlock;
1818
use Barryvdh\Reflection\DocBlock\Context;
19+
use Barryvdh\Reflection\DocBlock\ContextFactory;
1920
use Barryvdh\Reflection\DocBlock\Serializer as DocBlockSerializer;
2021
use Barryvdh\Reflection\DocBlock\Tag;
2122
use Composer\ClassMapGenerator\ClassMapGenerator;
@@ -49,7 +50,6 @@
4950
use Illuminate\Support\Collection;
5051
use Illuminate\Support\Str;
5152
use Illuminate\View\Factory as ViewFactory;
52-
use phpDocumentor\Reflection\Types\ContextFactory;
5353
use ReflectionClass;
5454
use ReflectionNamedType;
5555
use ReflectionObject;
@@ -1571,7 +1571,9 @@ protected function getClassNameInDestinationFile(object $model, string $classNam
15711571
*/
15721572
protected function getUsedClassNames(ReflectionClass $reflection): array
15731573
{
1574-
$namespaceAliases = array_flip((new ContextFactory())->createFromReflector($reflection)->getNamespaceAliases());
1574+
$namespaceAliases = array_flip(array_map(function ($alias) {
1575+
return ltrim($alias, '\\');
1576+
}, (new ContextFactory())->createFromReflector($reflection)->getNamespaceAliases()));
15751577
$namespaceAliases[$reflection->getName()] = $reflection->getShortName();
15761578

15771579
return $namespaceAliases;

0 commit comments

Comments
 (0)