psalm-plugin-laravel: models.stubphp out of sync

Psalm reported following error:

ERROR: InvalidArgument - app/Context/Product/Actions/UpdateEventGeneralCardAction.php:16:41 - Argument 2 of App\Context\Product\Actions\UpdateEventGeneralCardAction::saveProductDetail expects App\Context\Product\Models\ProductDetail, Illuminate\Database\Eloquent\Relations\BelongsTo provided (see https://psalm.dev/004)
        $this->saveProductDetail($data, $event->productDetail);

It seems like it didn’t recognise productDetail as the relation.

So I did some digging in _ide_helper_models.php, where the property seemed to exist:

* @property-read \App\Context\Product\Models\ProductDetail $productDetail

Looking at models.stubphp in vendor/psalm/plugin-laravel/src/cache/models.stubphp though, the property wasn’t present. It seemed like this file was an outdated version.

I’ve tried reinstalling psalm/plugin-laravel, but the same stub file, missing the property gets generated.

Any ideas?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

Oh no, those are morphs, not hasManyThrough; my bad

@brendt in the meantime, i think you should be able to load your own _ide_helper_models.php file as a stub file in your psalm.xml file.