Open santigarcor opened 3 months ago
Describe the bug Return type is not being flagged as the correct one, I'm calling the method showed below like this:
$results = ServiceData::collect($services, DataCollection::class)
And the return type recognised by Intelephense is \Illuminate\Support\Collection<array-key, \App\Data\ServiceData>
\Illuminate\Support\Collection<array-key, \App\Data\ServiceData>
According to the doc-block logic it should be DataCollection<array-key, \App\Data\ServiceData>
DataCollection<array-key, \App\Data\ServiceData>
To Reproduce
/** * @param Collection<TKey, TValue>|EloquentCollection<TKey, TValue>|LazyCollection<TKey, TValue>|Enumerable|array<TKey, TValue>|AbstractPaginator|PaginatorContract|AbstractCursorPaginator|CursorPaginatorContract|DataCollection<TKey, TValue> $items * * @return ($into is 'array' ? array<TKey, static> : ($into is class-string<EloquentCollection> ? Collection<TKey, static> : ($into is class-string<Collection> ? Collection<TKey, static> : ($into is class-string<LazyCollection> ? LazyCollection<TKey, static> : ($into is class-string<DataCollection> ? DataCollection<TKey, static> : ($into is class-string<PaginatedDataCollection> ? PaginatedDataCollection<TKey, static> : ($into is class-string<CursorPaginatedDataCollection> ? CursorPaginatedDataCollection<TKey, static> : ($items is EloquentCollection ? Collection<TKey, static> : ($items is Collection ? Collection<TKey, static> : ($items is LazyCollection ? LazyCollection<TKey, static> : ($items is Enumerable ? Enumerable<TKey, static> : ($items is array ? array<TKey, static> : ($items is AbstractPaginator ? AbstractPaginator : ($items is PaginatorContract ? PaginatorContract : ($items is AbstractCursorPaginator ? AbstractCursorPaginator : ($items is CursorPaginatorContract ? CursorPaginatorContract : ($items is DataCollection ? DataCollection<TKey, static> : ($items is CursorPaginator ? CursorPaginatedDataCollection<TKey, static> : ($items is Paginator ? PaginatedDataCollection<TKey, static> : DataCollection<TKey, static>))))))))))))))))))) */ public static function collect(mixed $items, ?string $into = null): array|DataCollection|PaginatedDataCollection|CursorPaginatedDataCollection|Enumerable|AbstractPaginator|PaginatorContract|AbstractCursorPaginator|CursorPaginatorContract|LazyCollection|Collection;
Expected behavior To show the return type as DataCollection<array-key, \App\Data\ServiceData>
Screenshots
Platform and version MacOS 14.4 (23E214), Intelephense Premium v1.10.4
Describe the bug Return type is not being flagged as the correct one, I'm calling the method showed below like this:
And the return type recognised by Intelephense is
\Illuminate\Support\Collection<array-key, \App\Data\ServiceData>
According to the doc-block logic it should be
DataCollection<array-key, \App\Data\ServiceData>
To Reproduce
Expected behavior To show the return type as
DataCollection<array-key, \App\Data\ServiceData>
Screenshots
Platform and version MacOS 14.4 (23E214), Intelephense Premium v1.10.4