mirror of
https://github.com/flarum/core.git
synced 2025-08-11 19:04:29 +02:00
Cleanup code, typehints and class references
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Flarum\Notification\Blueprint;
|
||||
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Post\DiscussionRenamedPost;
|
||||
|
||||
class DiscussionRenamedBlueprint implements BlueprintInterface
|
||||
@@ -65,6 +66,6 @@ class DiscussionRenamedBlueprint implements BlueprintInterface
|
||||
*/
|
||||
public static function getSubjectModel()
|
||||
{
|
||||
return 'Flarum\Discussion\Discussion';
|
||||
return Discussion::class;
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Flarum\Notification;
|
||||
|
||||
use Flarum\Database\AbstractModel;
|
||||
use Flarum\User\User;
|
||||
|
||||
/**
|
||||
* Models a notification record in the database.
|
||||
@@ -113,7 +114,7 @@ class Notification extends AbstractModel
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('Flarum\User\User', 'user_id');
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,7 +124,7 @@ class Notification extends AbstractModel
|
||||
*/
|
||||
public function sender()
|
||||
{
|
||||
return $this->belongsTo('Flarum\User\User', 'sender_id');
|
||||
return $this->belongsTo(User::class, 'sender_id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -13,6 +13,7 @@ namespace Flarum\Notification;
|
||||
|
||||
use Flarum\Event\ConfigureNotificationTypes;
|
||||
use Flarum\Foundation\AbstractServiceProvider;
|
||||
use Flarum\Notification\Blueprint\DiscussionRenamedBlueprint;
|
||||
use Flarum\User\User;
|
||||
use ReflectionClass;
|
||||
|
||||
@@ -32,7 +33,7 @@ class NotificationServiceProvider extends AbstractServiceProvider
|
||||
public function registerNotificationTypes()
|
||||
{
|
||||
$blueprints = [
|
||||
'Flarum\Notification\Blueprint\DiscussionRenamedBlueprint' => ['alert']
|
||||
DiscussionRenamedBlueprint::class => ['alert']
|
||||
];
|
||||
|
||||
$this->app->make('events')->fire(
|
||||
@@ -51,7 +52,7 @@ class NotificationServiceProvider extends AbstractServiceProvider
|
||||
in_array('alert', $enabled)
|
||||
);
|
||||
|
||||
if ((new ReflectionClass($blueprint))->implementsInterface('Flarum\Notification\MailableInterface')) {
|
||||
if ((new ReflectionClass($blueprint))->implementsInterface(MailableInterface::class)) {
|
||||
User::addPreference(
|
||||
User::getNotificationPreferenceKey($type, 'email'),
|
||||
'boolval',
|
||||
|
Reference in New Issue
Block a user