mirror of
https://github.com/flarum/core.git
synced 2025-07-27 11:40:24 +02:00
Use ::class, update some typehints
This commit is contained in:
@@ -23,7 +23,6 @@ use Flarum\Foundation\EventGeneratorTrait;
|
|||||||
use Flarum\Post\Event\Deleted as PostDeleted;
|
use Flarum\Post\Event\Deleted as PostDeleted;
|
||||||
use Flarum\Post\MergeableInterface;
|
use Flarum\Post\MergeableInterface;
|
||||||
use Flarum\Post\Post;
|
use Flarum\Post\Post;
|
||||||
use Flarum\User\Guest;
|
|
||||||
use Flarum\User\User;
|
use Flarum\User\User;
|
||||||
use Flarum\Util\Str;
|
use Flarum\Util\Str;
|
||||||
|
|
||||||
@@ -101,7 +100,7 @@ class Discussion extends AbstractModel
|
|||||||
{
|
{
|
||||||
parent::boot();
|
parent::boot();
|
||||||
|
|
||||||
static::deleted(function ($discussion) {
|
static::deleted(function (Discussion $discussion) {
|
||||||
$discussion->raise(new Deleted($discussion));
|
$discussion->raise(new Deleted($discussion));
|
||||||
|
|
||||||
// Delete all of the posts in the discussion. Before we delete them
|
// Delete all of the posts in the discussion. Before we delete them
|
||||||
@@ -234,6 +233,7 @@ class Discussion extends AbstractModel
|
|||||||
*/
|
*/
|
||||||
public function refreshLastPost()
|
public function refreshLastPost()
|
||||||
{
|
{
|
||||||
|
/** @var Post $lastPost */
|
||||||
if ($lastPost = $this->comments()->latest('time')->first()) {
|
if ($lastPost = $this->comments()->latest('time')->first()) {
|
||||||
$this->setLastPost($lastPost);
|
$this->setLastPost($lastPost);
|
||||||
}
|
}
|
||||||
@@ -356,7 +356,7 @@ class Discussion extends AbstractModel
|
|||||||
*/
|
*/
|
||||||
public function startPost()
|
public function startPost()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('Flarum\Post\Post', 'start_post_id');
|
return $this->belongsTo(Post::class, 'start_post_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -366,7 +366,7 @@ class Discussion extends AbstractModel
|
|||||||
*/
|
*/
|
||||||
public function startUser()
|
public function startUser()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('Flarum\User\User', 'start_user_id');
|
return $this->belongsTo(User::class, 'start_user_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -376,7 +376,7 @@ class Discussion extends AbstractModel
|
|||||||
*/
|
*/
|
||||||
public function lastPost()
|
public function lastPost()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('Flarum\Post\Post', 'last_post_id');
|
return $this->belongsTo(Post::class, 'last_post_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -386,7 +386,7 @@ class Discussion extends AbstractModel
|
|||||||
*/
|
*/
|
||||||
public function lastUser()
|
public function lastUser()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('Flarum\User\User', 'last_user_id');
|
return $this->belongsTo(User::class, 'last_user_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -396,7 +396,7 @@ class Discussion extends AbstractModel
|
|||||||
*/
|
*/
|
||||||
public function readers()
|
public function readers()
|
||||||
{
|
{
|
||||||
return $this->belongsToMany('Flarum\User\User', 'users_discussions');
|
return $this->belongsToMany(User::class, 'users_discussions');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -415,7 +415,7 @@ class Discussion extends AbstractModel
|
|||||||
{
|
{
|
||||||
$user = $user ?: static::$stateUser;
|
$user = $user ?: static::$stateUser;
|
||||||
|
|
||||||
return $this->hasOne('Flarum\Discussion\UserState')->where('user_id', $user ? $user->id : null);
|
return $this->hasOne(UserState::class)->where('user_id', $user ? $user->id : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user