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

Add @see location for macros & mixins to PhpDoc #1054

Merged
merged 6 commits into from
Sep 11, 2020

Conversation

riesjart
Copy link
Contributor

@riesjart riesjart commented Sep 11, 2020

Summary

This PR adds an @see with the macro/mixin definition location to PhpDoc.

Macro example

Logic:

class CollectionServiceProvider
{
    public function boot(): void
    {
        \Illuminate\Support\Collection::macro('toEloquent', function(): \Illuminate\Database\Eloquent\Collection {

            return \Illuminate\Database\Eloquent\Collection::make($this);
        });
    }
}

IDE helper:

/**
 * @see \Collection\CollectionServiceProvider::boot()
 * @return \Illuminate\Database\Eloquent\Collection
 * @static
 */
public static function toEloquent()
{
    return \Illuminate\Support\Collection::toEloquent();
}

Mixin example

Logic:

/**
 * @mixin \Illuminate\Support\Collection
 */
class CollectionMixin
{
    public function toEloquent(): Closure
    {
        return function(): \Illuminate\Database\Eloquent\Collection {

            return \Illuminate\Database\Eloquent\Collection::make($this);
        };
    }
}

IDE helper:

/**
 * @see \Collection\CollectionMixin::toEloquent()
 * @return \Illuminate\Database\Eloquent\Collection
 * @static
 */
public static function toEloquent()
{
    return \Illuminate\Support\Collection::toEloquent();
}

Type of change

  • New feature (non-breaking change which adds functionality)

Copy link
Collaborator

@mfn mfn left a comment

Choose a reason for hiding this comment

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

Nice one, LGTM!

We don't have any testing infrastructure for this, but tested it one a private project, found no issues

@barryvdh IMHO good to merge!

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