psalm-plugin-laravel icon indicating copy to clipboard operation
psalm-plugin-laravel copied to clipboard

`@property` seems to be ignored on model classes

Open brendt opened this issue 3 years ago • 1 comments

I've got this model class:

/**
 * @property-read \App\Domain\Equipment\State\ArticleCategoryType\ArticleCategoryType $type
 * @property-read \App\Domain\Equipment\State\ArticleCategoryTarget\ArticleCategoryTarget $target
 */
class ArticleCategory extends Model

But whenever calling ->type on a model instance, Psalm things type is a string or null:

InvalidReturnType - app/Domain/Equipment/Models/ArticleCategory.php:159:32 - The declared return type 'App\Domain\Equipment\State\ArticleCategoryType\ArticleCategoryType' for App\Domain\Equipment\Models\ArticleCategory::getType is incorrect, got 'null|string'

brendt avatar Dec 15 '21 09:12 brendt

Duplicate of #193.

caugner avatar Jan 21 '22 16:01 caugner