-
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
fix: Support @property on Model with imported type #170
Conversation
@mr-feek The root of the problem is probably located in psalm-plugin-laravel/src/Handlers/Eloquent/ModelPropertyAccessorHandler.php Lines 56 to 70 in 7f15023
edit: I'm unable to debug the codeception run in PhpStorm, despite having the plugin enabled. Any tips? |
@caugner yeah, it's a really frustrating experience. What I have started doing recently is cloning a fresh laravel install and adding the code I want to analyze. Then I require this plugin via composer, however use a symlink to load it in locally . Then I'm able to get xdebug working. this is the command I use: |
So the reason why the For example, the namespace Tests\Psalm\LaravelPlugin\Models{
/**
* Tests\Psalm\LaravelPlugin\Models\User
*
* @property string $id
* @property CarbonInterface $email_verified_at
* @property-read \Illuminate\Database\Eloquent\Collection|\Tests\Psalm\LaravelPlugin\Models\Mechanic[] $carsAtMechanic
* @property-read int|null $cars_at_mechanic_count
* @property-read \Tests\Psalm\LaravelPlugin\Models\Image|null $image
* @property-read \Tests\Psalm\LaravelPlugin\Models\Phone|null $phone
* @property-read \Illuminate\Database\Eloquent\Collection|\Tests\Psalm\LaravelPlugin\Models\Role[] $roles
* @property-read int|null $roles_count
* @method static \Illuminate\Database\Eloquent\Builder|User active()
* @method static \Illuminate\Database\Eloquent\Builder|User newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|User newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|User query()
*/
final class User extends \Eloquent {} Now the question is whether this is a bug in |
This avoids that existing @Property annotations are copied to cache/models.stubphp, which caused annotated properties that use an imported type to break, because the imports are not copied over.
Originally reported in vimeo/psalm#6024.