Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added generics to Context #22

Merged
merged 1 commit into from
Dec 24, 2024

Conversation

chack1172
Copy link

This change will allow laravel-ide-helper to pass generics of class template to methods DocBlock using Context class.

Example class:

/**
 * @template TModel of \Illuminate\Database\Eloquent\Model
 */
class Builder
{
    /**
     * Get the first record matching the attributes or instantiate it.
     *
     * @param  array  $attributes
     * @param  array  $values
     * @return TModel
     */
    public function firstOrNew(array $attributes = [], array $values = [])
    {}
}

In this way:

$classDocBlock = new DocBlock($classDocBlockText);
$methodDocBlock = new DocBlock($methodDocBlockText, new Context($namespace, $classAliases, '', $classDocBlock->getGenerics()))

@barryvdh barryvdh merged commit 476f62b into barryvdh:master Dec 24, 2024
16 checks passed
@chack1172 chack1172 deleted the bugfix/class-generics branch December 24, 2024 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants