Skip to content

Wrong namespaces generated in _ide_helper.php file #1659

Open
@ayrtonandino

Description

@ayrtonandino

Versions:

  • ide-helper Version: 3.5.3
  • Laravel Version: 11.37.0
  • PHP Version: 8.3.15

Description:

Recent version fixed namespaces for @template and phpdoc types, but there are some types still getting wrong namespaces prepended to them.

These are the ones I could find in _ide_helper.php file:

  • array shape => \Illuminate\Cache\array{ **shape** }, should be array{ **shape** }
  • \Closure => \Illuminate\Events\Queued\Closure, should be \Closure
  • specific string => \Illuminate\Foundation\'waterfall'|\Illuminate\Foundation\'aggressive' , should be 'waterfall'|'aggressive'
  • callable with function parameters => \Illuminate\Database\Eloquent\callable(something)| \Symfony\Component\HttpFoundation\callable(something) should be callable(something)

Examples of wrong namespaces:

array shape

/**
 * Retrieve an item from the cache by key, refreshing it in the background if it is stale.
 *
 * @template TCacheValue
 *
 * @param  string  $key
 * @param \Illuminate\Cache\array{  0: \DateTimeInterface|\DateInterval|int, 1: \DateTimeInterface|\DateInterval|int }  $ttl
 * @param  (callable(): TCacheValue)  $callback
 * @param \Illuminate\Cache\array{  seconds?: int, owner?: string }|null  $lock
 * @return TCacheValue
 *
 * @static
 */
public static function flexible($key, $ttl, $callback, $lock = null)
{
    /** @var \Illuminate\Cache\Repository $instance */
    return $instance->flexible($key, $ttl, $callback, $lock);
}
wrong

@param \Illuminate\Cache\array{ 0: \DateTimeInterface|\DateInterval|int, 1: \DateTimeInterface|\DateInterval|int } $ttl

correct

@param array{ 0: \DateTimeInterface|\DateInterval|int, 1: \DateTimeInterface|\DateInterval|int } $ttl

\Closure

/**
 * Register an event listener with the dispatcher.
 *
 * @param  \Illuminate\Events\Queued\Closure|callable|array|class-string|string  $events
 * @param  \Illuminate\Events\Queued\Closure|callable|array|class-string|null  $listener
 * @return void
 *
 * @static
 */
public static function listen($events, $listener = null)
{
    /** @var \Illuminate\Events\Dispatcher $instance */
    $instance->listen($events, $listener);
}
wrong

@param \Illuminate\Events\Queued\Closure|callable|array|class-string|string $events

correct

@param \Closure|callable|array|class-string|string $events

specific string

/**
 * Set the prefetching strategy.
 *
 * @param \Illuminate\Foundation\'waterfall'|\Illuminate\Foundation\'aggressive'|null $strategy
 * @param  array  $config
 * @return \Illuminate\Foundation\Vite
 *
 * @static
 */
public static function usePrefetchStrategy($strategy, $config = [])
{
    /** @var \Illuminate\Foundation\Vite $instance */
    return $instance->usePrefetchStrategy($strategy, $config);
}
wrong

@param \Illuminate\Foundation\'waterfall'|\Illuminate\Foundation\'aggressive'|null $strategy

correct

@param 'waterfall'|'aggressive'|null $strategy

callable

/**
 * Chunk the results of the query.
 *
 * @param  int  $count
 * @param  \Illuminate\Database\Eloquent\callable(\Illuminate\Support\Collection<int, TValue>, int):  mixed  $callback
 * @return bool
 *
 * @static
 */
public static function chunk($count, $callback)
{
    /** @var \Illuminate\Database\Eloquent\Builder $instance */
    return $instance->chunk($count, $callback);
}
wrong

@param \Illuminate\Database\Eloquent\callable(\Illuminate\Support\Collection<int, TValue>, int): mixed $callback

correct

@param callable(\Illuminate\Support\Collection<int, TValue>, int): mixed $callback

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions