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

not interprets @mixin annotations. #123

Open
xiaohuilam opened this issue Aug 5, 2018 · 20 comments
Open

not interprets @mixin annotations. #123

xiaohuilam opened this issue Aug 5, 2018 · 20 comments
Labels

Comments

@xiaohuilam
Copy link

@xiaohuilam xiaohuilam commented Aug 5, 2018

This extension works perfect under vscode.

but interprets @mixin annotations. eg: laravel's framework code..

<?php

namespace Illuminate\Database\Eloquent;

use Exception;
use ArrayAccess;
use JsonSerializable;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Routing\UrlRoutable;
use Illuminate\Contracts\Queue\QueueableEntity;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Contracts\Queue\QueueableCollection;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Database\ConnectionResolverInterface as Resolver;

/**
 * 
 *
 * @mixin \Eloquent
 * @mixin \Illuminate\Database\Query\Builder
 * @mixin \Illuminate\Database\Eloquent\Builder
 */
abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializable, QueueableEntity, UrlRoutable
{
    use Concerns\HasAttributes,
        Concerns\HasEvents,
        Concerns\HasGlobalScopes,
        Concerns\HasRelationships,
        Concerns\HasTimestamps,
        Concerns\HidesAttributes,
        Concerns\GuardsAttributes;
@andreshg112

This comment has been minimized.

Copy link

@andreshg112 andreshg112 commented Oct 30, 2018

Same here!

@xiaohuilam

This comment has been minimized.

Copy link
Author

@xiaohuilam xiaohuilam commented Feb 26, 2019

That's a so great feature, It will be bravo if only vsc-intel did recognize mixin.

@nmsmith22389

This comment has been minimized.

Copy link

@nmsmith22389 nmsmith22389 commented May 27, 2019

Any updates on this? This is one of the only things that this extension is missing. Please implement it! 🙏

@xiaohuilam

This comment has been minimized.

Copy link
Author

@xiaohuilam xiaohuilam commented Aug 24, 2019

Hey @bmewburn, did you forget this feature?

@d8vjork

This comment has been minimized.

Copy link

@d8vjork d8vjork commented Aug 29, 2019

Also get the same feature request today working with traits (1 year old issue, wow)

This will be wonderful for everything on PHP

@star2000

This comment has been minimized.

Copy link

@star2000 star2000 commented Sep 11, 2019

Is it difficult to support @mixin? @bmewburn

@bmewburn

This comment has been minimized.

Copy link
Owner

@bmewburn bmewburn commented Oct 6, 2019

Is it just Laravel that needs this? With barryvdh/laravel-ide-helper ? Reason I haven't prioritised it is because @mixin is not a standard annotation and doesn't look like it will be standardised. I think it only gained some support back before PHP had traits.

@xiaohuilam

This comment has been minimized.

Copy link
Author

@xiaohuilam xiaohuilam commented Oct 6, 2019

Is it just Laravel that needs this? With barryvdh/laravel-ide-helper ? Reason I haven't prioritised it is because @mixin is not a standard annotation and doesn't look like it will be standardised. I think it only gained some support back before PHP had traits.

I guess not, There should be many frameworks which prefer to use __call or __callStatic magic, they will ask for @mixin to support annotations.

@xiaohuilam

This comment has been minimized.

Copy link
Author

@xiaohuilam xiaohuilam commented Oct 6, 2019

barryvdh/laravel-ide-helper

The package barryvdh/laravel-ide-helper is helpless with @mixin, it can only help to generate Facade methods、Model column properties and scope methods, and ioc (phpstorm.meta.php), but can't enhancement for @mixin(i guess the reason is that phpstorm native support @mixin )

@bmewburn

This comment has been minimized.

Copy link
Owner

@bmewburn bmewburn commented Oct 6, 2019

Models can extend the \Eloquent class it generates instead of \Illuminate\Database\Eloquent\Model.

@benyaminl

This comment has been minimized.

Copy link

@benyaminl benyaminl commented Oct 8, 2019

Models can extend the \Eloquent class it generates instead of \Illuminate\Database\Eloquent\Model.

I have tried the extension. No hope for it. Still rely on mixin and Barry extension doesn't support all facade

@bmewburn

This comment has been minimized.

Copy link
Owner

@bmewburn bmewburn commented Oct 8, 2019

Can I get an example of what methods aren't shown when extending \Eloquent? In my tests barryvdh/laravel-ide-helper works well.

Screenshot from 2019-10-08 21-27-11

@benyaminl

This comment has been minimized.

Copy link

@benyaminl benyaminl commented Oct 8, 2019

@xiaohuilam

This comment has been minimized.

Copy link
Author

@xiaohuilam xiaohuilam commented Oct 12, 2019

Not only the lumen, But also App\User which extends from Illuminate\Foundation\Auth\User is hardcoded to extend Illuminate\Database\Eloquent\Model, makes us hard to manipulate to Eloquent

@benyaminl

This comment has been minimized.

Copy link

@benyaminl benyaminl commented Oct 12, 2019

Illuminate\Foundation\Auth\User

Ugh seems yes. https://laravel.com/api/5.6/Illuminate/Foundation/Auth/User.html I never touch it because it's my friend job so I never know this.

Anyway let Ben decide first, I think if it's about money then why don't we set up the patreon again :v
So like new features will be shipped faster if it gets supporter.

@bmewburn

This comment has been minimized.

Copy link
Owner

@bmewburn bmewburn commented Oct 12, 2019

I'm not saying this won't get implemented. I'm just trying to understand the need for it and to decide the priority amongst all the other issues.

@zedisdog

This comment has been minimized.

Copy link

@zedisdog zedisdog commented Oct 16, 2019

with this feature, I can use vscode instead of phpstorm.😆

@benyaminl

This comment has been minimized.

Copy link

@benyaminl benyaminl commented Oct 16, 2019

@slcastroj

This comment has been minimized.

Copy link

@slcastroj slcastroj commented Dec 17, 2019

@bmewburn Mixin is required for it to show both \Eloquent and MyModel methods e.g. where vs whereField or all vs get while using IDE helper. A workaround is to use /** @var MyModel|\Eloquent */ over each variable so you can get full autocompletion.

Edit: Sorry, this is not the case, or maybe I didn't use IDE helper the right way before. Mixin support would enable full autocompletion with IDE helper without having to replace all model extends with \Eloquent for it to work. It would be pretty laravel-specific.

@neoighodaro

This comment has been minimized.

Copy link

@neoighodaro neoighodaro commented Jan 26, 2020

@bmewburn Mixin is required for it to show both \Eloquent and MyModel methods e.g. where vs whereField or all vs get while using IDE helper. A workaround is to use /** @var MyModel|\Eloquent */ over each variable so you can get full autocompletion.

Edit: Sorry, this is not the case, or maybe I didn't use IDE helper the right way before. Mixin support would enable full autocompletion with IDE helper without having to replace all model extends with \Eloquent for it to work. It would be pretty laravel-specific.

What he said. I was a little surprised to know it did not support it. Its a very useful feature. I wont type everything he said as a reason since he alrewady mentioned it, but it's very useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
10 participants
You can’t perform that action at this time.