Skip to content

FQCN not detected when using template types #17

@GlennBergmans

Description

@GlennBergmans

When using templated classes (e.g. <Type> syntax), the FQCN is not detected.

Example:

namespace App\Models;

use Illuminate\Database\Eloquent\Relations\HasMany;

class Foo extends Model
{
    /**
     * @return HasMany<Bar, $this>
     */
    public function bars(): HasMany
    {
        return $this->hasMany(Bar::class);
    }
}

Should generate:

namespace App\Models;

use Illuminate\Database\Eloquent\Relations\HasMany;

class Foo extends Model
{
    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany<Bar, $this>
     */
    public function bars(): HasMany
    {
        return $this->hasMany(Bar::class);
    }
}

Without <Bar, $this> the FQCN is correctly replaced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions