1
0
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:
Franz Liedke
2017-07-02 13:29:30 +02:00
parent e46b3d54d1
commit 4aad7c1040
23 changed files with 87 additions and 69 deletions

View File

@@ -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;
}
}

View File

@@ -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');
}
/**

View File

@@ -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',