mirror of
https://github.com/danog/psalm-plugin-laravel.git
synced 2024-11-27 04:45:26 +01:00
37 lines
869 B
PHP
37 lines
869 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace Tests\Psalm\LaravelPlugin\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\MorphOne;
|
|
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
|
|
|
final class Post extends Model {
|
|
protected $table = 'posts';
|
|
|
|
/**
|
|
* @psalm-return HasMany<Comment>
|
|
*/
|
|
public function comments(): HasMany
|
|
{
|
|
return $this->hasMany(Comment::class);
|
|
}
|
|
|
|
/**
|
|
* @psalm-return MorphOne<Image>
|
|
*/
|
|
public function image(): MorphOne
|
|
{
|
|
return $this->morphOne(Image::class, 'imageable');
|
|
}
|
|
|
|
/**
|
|
* @psalm-return \Illuminate\Database\Eloquent\Relations\MorphToMany<Tag>
|
|
*/
|
|
public function tags(): MorphToMany
|
|
{
|
|
return $this->morphToMany(Tag::class, 'taggable');
|
|
}
|
|
}
|