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

fix(docblocks): Mitigate issue in ide-helper docblock parsing #69

Merged
merged 2 commits into from
Jan 19, 2024

Conversation

saibotk
Copy link
Member

@saibotk saibotk commented Dec 27, 2023

The generation code has some issues with imported class names in docblocks. It does not resolve those properly and thus leads to incorrect annotations. This was mitigated by transforming all current macro annotations to use the fully qualified class names

See barryvdh/laravel-ide-helper#953

Before this PR:

/**
 *
 *
 * @param array|string|\MagellanBaseExpression $groups
 * @return static
 * @see \Clickbar\Magellan\Database\Builder\BuilderMacros::stGroupBy()
 * @static
 */
public static function stGroupBy(...$groups)
{
    return \Illuminate\Database\Query\Builder::stGroupBy(...$groups);
}

After:

/**
 *
 *
 * @param array|string|\Clickbar\Magellan\Database\MagellanExpressions\MagellanBaseExpression $groups
 * @return static
 * @see \Clickbar\Magellan\Database\Builder\BuilderMacros::stGroupBy()
 * @static
 */
public static function stGroupBy(...$groups)
{
    return \Illuminate\Database\Query\Builder::stGroupBy(...$groups);
}

The generation code has some issues with imported class names in docblocks.
It does not resolve those properly and thus leads to incorrect annotations.
This was mitigated by transforming all current macro annotations to use the fully qualified class names

See barryvdh/laravel-ide-helper#953

Before this PR:
```php
/**
 *
 *
 * @param array|string|\MagellanBaseExpression $groups
 * @return static
 * @see \Clickbar\Magellan\Database\Builder\BuilderMacros::stGroupBy()
 * @static
 */
public static function stGroupBy(...$groups)
{
    return \Illuminate\Database\Query\Builder::stGroupBy(...$groups);
}
```

After:
```php
/**
 *
 *
 * @param array|string|\Clickbar\Magellan\Database\MagellanExpressions\MagellanBaseExpression $groups
 * @return static
 * @see \Clickbar\Magellan\Database\Builder\BuilderMacros::stGroupBy()
 * @static
 */
public static function stGroupBy(...$groups)
{
    return \Illuminate\Database\Query\Builder::stGroupBy(...$groups);
}
```
@saibotk saibotk self-assigned this Dec 27, 2023
Base automatically changed from st-from-as to main January 19, 2024 09:17
Copy link
Member

@ahawlitschek ahawlitschek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@Vanilagy Vanilagy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgbt

@ahawlitschek ahawlitschek merged commit 04c91a6 into main Jan 19, 2024
20 checks passed
@ahawlitschek ahawlitschek deleted the fix-type-annotations-ide-helper branch January 19, 2024 09:20
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.

3 participants