-
Notifications
You must be signed in to change notification settings - Fork 66
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
Remove unused getPropertiesFromMethods method #109
Conversation
There might be one related side effect, so I'll discuss it here. This piece of docblock is taken from the generated models file: namespace App\Context\Product\Models{
/**
* …
*
* @method static \App\Context\Product\QueryBuilders\CourseQueryBuilder|Course newModelQuery()
* @method static \App\Context\Product\QueryBuilders\CourseQueryBuilder|Course newQuery()
* @method static \App\Context\Product\QueryBuilders\CourseQueryBuilder|Course query()
*/
class Course extends \Eloquent implements \App\Context\Product\Models\Concerns\WithCompliance, \App\Support\ActivityLog\ActivityLoggable, \App\Support\IsModel {}
} Notice how Psalm reports the following error:
Now sure, -@method static \App\Context\Product\QueryBuilders\CourseQueryBuilder|Course query()
+@method static \App\Context\Product\QueryBuilders\CourseQueryBuilder query() So whenever the union type I think this is a standalone error, but it only popped up after using this PR's implementation of FakeModelCommand, so I think the broken implementation was hiding another bug. If someone can confirm that's probably the case, I'll make a separate issue. |
Yeah, I think the tests are legitimately failing. I don't have much free time right now to help with a solution, but I did this over at larastan a while ago larastan/larastan#479 Basically it parses the docblock and turns it into a typed collection instead |
@brendt so the docblock should just be |
I believe it should be |
Yeah, this is definitely a bug on Psalm's side |
Actually not a Psalm bug – the plugin is providing a generic stub for the parent class with the correct return type, and one for the child class generated via I resorted to a slightly nasty hack where I'm just removing the docblock-provided methods before Psalm has a chance to use them: acbfcaa#diff-9f7143a3a98cd6114dd5e4a17d64faa9R128 |
Awesome, will test this later today :) |
Hm, I've now encountered a fatal error when running psalm, but I'm not entirely sure whether it's related or not:
I'm using the following commits:
|
I'm happy to say all works now, thanks for the help both! |
This PR fixes #98 .
The empty
getPropertiesFromMethods
method is clearly a bug, since it adds crucial information to the ide helper models file.By removing it, the original implementation is used again, and that works fine. I've tested this in our own Laravel project, and it fixes the issue described in #98.