From 920a4071b61ba943c2b7db594fa7c8d341b11f93 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Sat, 24 Jun 2017 14:10:39 +0200 Subject: [PATCH] Fix some incorrect automated refactorings --- src/Api/Serializer/BasicPostSerializer.php | 4 ++-- src/Core/Command/DeletePostHandler.php | 2 +- src/Core/Command/EditPostHandler.php | 2 +- src/Core/CoreServiceProvider.php | 4 ++-- src/Discussion/Discussion.php | 4 ++-- .../Search/Fulltext/MySqlFulltextDriver.php | 2 +- src/Post/PostRepository.php | 2 +- src/User/User.php | 5 ++--- src/User/UserMetadataUpdater.php | 14 +++++++------- 9 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/Api/Serializer/BasicPostSerializer.php b/src/Api/Serializer/BasicPostSerializer.php index 2e0a75951..b63b6dec6 100644 --- a/src/Api/Serializer/BasicPostSerializer.php +++ b/src/Api/Serializer/BasicPostSerializer.php @@ -11,7 +11,7 @@ namespace Flarum\Api\Serializer; -use Flarum\Core\Post; +use Flarum\Post\Post; use Flarum\Post\CommentPost; use InvalidArgumentException; @@ -25,7 +25,7 @@ class BasicPostSerializer extends AbstractSerializer /** * {@inheritdoc} * - * @param \Flarum\Core\Post $post + * @param \Flarum\Post\Post $post * @throws InvalidArgumentException */ protected function getDefaultAttributes($post) diff --git a/src/Core/Command/DeletePostHandler.php b/src/Core/Command/DeletePostHandler.php index 176aa5d3f..541c5cb40 100644 --- a/src/Core/Command/DeletePostHandler.php +++ b/src/Core/Command/DeletePostHandler.php @@ -40,7 +40,7 @@ class DeletePostHandler /** * @param DeletePost $command - * @return \Flarum\Core\Post + * @return \Flarum\Post\Post * @throws \Flarum\User\Exception\PermissionDeniedException */ public function handle(DeletePost $command) diff --git a/src/Core/Command/EditPostHandler.php b/src/Core/Command/EditPostHandler.php index af0a52a45..7bca65370 100644 --- a/src/Core/Command/EditPostHandler.php +++ b/src/Core/Command/EditPostHandler.php @@ -48,7 +48,7 @@ class EditPostHandler /** * @param EditPost $command - * @return \Flarum\Core\Post + * @return \Flarum\Post\Post * @throws \Flarum\User\Exception\PermissionDeniedException */ public function handle(EditPost $command) diff --git a/src/Core/CoreServiceProvider.php b/src/Core/CoreServiceProvider.php index ed79cbfaf..82e5f6b0d 100644 --- a/src/Core/CoreServiceProvider.php +++ b/src/Core/CoreServiceProvider.php @@ -124,8 +124,8 @@ class CoreServiceProvider extends AbstractServiceProvider public function registerPostTypes() { $models = [ - 'Flarum\Post\Post\CommentPost', - 'Flarum\Post\Post\DiscussionRenamedPost' + 'Flarum\Post\CommentPost', + 'Flarum\Post\DiscussionRenamedPost' ]; $this->app->make('events')->fire( diff --git a/src/Discussion/Discussion.php b/src/Discussion/Discussion.php index 34122fd90..0b06f632f 100644 --- a/src/Discussion/Discussion.php +++ b/src/Discussion/Discussion.php @@ -21,7 +21,7 @@ use Flarum\Discussion\Event\Hidden; use Flarum\Discussion\Event\Renamed; use Flarum\Discussion\Event\Restored; use Flarum\Discussion\Event\Started; -use Flarum\Post\Event\Deleted; +use Flarum\Post\Event\Deleted as PostDeleted; use Flarum\Event\ScopePostVisibility; use Flarum\Post\Post; use Flarum\User\Guest; @@ -111,7 +111,7 @@ class Discussion extends AbstractModel $posts = $discussion->posts()->allTypes(); foreach ($posts->get() as $post) { - $discussion->raise(new Deleted($post)); + $discussion->raise(new PostDeleted($post)); } $posts->delete(); diff --git a/src/Discussion/Search/Fulltext/MySqlFulltextDriver.php b/src/Discussion/Search/Fulltext/MySqlFulltextDriver.php index 8c71066d6..0c1136297 100644 --- a/src/Discussion/Search/Fulltext/MySqlFulltextDriver.php +++ b/src/Discussion/Search/Fulltext/MySqlFulltextDriver.php @@ -11,7 +11,7 @@ namespace Flarum\Discussion\Search\Fulltext; -use Flarum\Core\Post; +use Flarum\Post\Post; class MySqlFulltextDriver implements DriverInterface { diff --git a/src/Post/PostRepository.php b/src/Post/PostRepository.php index a43ce300c..e6a38af03 100644 --- a/src/Post/PostRepository.php +++ b/src/Post/PostRepository.php @@ -34,7 +34,7 @@ class PostRepository * * @param int $id * @param \Flarum\User\User $actor - * @return \Flarum\Core\Post + * @return \Flarum\Post\Post * * @throws \Illuminate\Database\Eloquent\ModelNotFoundException */ diff --git a/src/User/User.php b/src/User/User.php index 24a6ab8bb..70396e6ff 100755 --- a/src/User/User.php +++ b/src/User/User.php @@ -12,7 +12,6 @@ namespace Flarum\User; use DomainException; -use Flarum\User\Gate; use Flarum\Group\Group; use Flarum\Core\Notification; use Flarum\Group\Permission; @@ -21,7 +20,7 @@ use Flarum\Database\ScopeVisibilityTrait; use Flarum\Database\AbstractModel; use Flarum\Event\CheckUserPassword; use Flarum\Event\ConfigureUserPreferences; -use Flarum\Post\Event\Deleted; +use Flarum\Post\Event\Deleted as PostDeleted; use Flarum\Event\PrepareUserGroups; use Flarum\User\Event\AvatarChanged; use Flarum\User\Event\BioChanged; @@ -136,7 +135,7 @@ class User extends AbstractModel $posts = $user->posts()->allTypes(); foreach ($posts->get() as $post) { - $user->raise(new Deleted($post)); + $user->raise(new PostDeleted($post)); } $posts->delete(); diff --git a/src/User/UserMetadataUpdater.php b/src/User/UserMetadataUpdater.php index 3cf33979a..a690813dd 100755 --- a/src/User/UserMetadataUpdater.php +++ b/src/User/UserMetadataUpdater.php @@ -12,13 +12,13 @@ namespace Flarum\User; use Flarum\Discussion\Discussion; -use Flarum\Core\Post; -use Flarum\Discussion\Event\Deleted; +use Flarum\Discussion\Event\Deleted as DiscussionDeleted; use Flarum\Discussion\Event\Started; -use Flarum\Post\Event\Deleted; +use Flarum\Post\Event\Deleted as PostDeleted; use Flarum\Post\Event\Hidden; use Flarum\Post\Event\Posted; use Flarum\Post\Event\Restored; +use Flarum\Post\Post; use Illuminate\Contracts\Events\Dispatcher; class UserMetadataUpdater @@ -29,11 +29,11 @@ class UserMetadataUpdater public function subscribe(Dispatcher $events) { $events->listen(Posted::class, [$this, 'whenPostWasPosted']); - $events->listen(Deleted::class, [$this, 'whenPostWasDeleted']); + $events->listen(PostDeleted::class, [$this, 'whenPostWasDeleted']); $events->listen(Hidden::class, [$this, 'whenPostWasHidden']); $events->listen(Restored::class, [$this, 'whenPostWasRestored']); $events->listen(Started::class, [$this, 'whenDiscussionWasStarted']); - $events->listen(Deleted::class, [$this, 'whenDiscussionWasDeleted']); + $events->listen(DiscussionDeleted::class, [$this, 'whenDiscussionWasDeleted']); } /** @@ -47,7 +47,7 @@ class UserMetadataUpdater /** * @param \Flarum\Post\Event\Deleted $event */ - public function whenPostWasDeleted(Deleted $event) + public function whenPostWasDeleted(PostDeleted $event) { $this->updateCommentsCount($event->post, -1); } @@ -79,7 +79,7 @@ class UserMetadataUpdater /** * @param \Flarum\Discussion\Event\Deleted $event */ - public function whenDiscussionWasDeleted(Deleted $event) + public function whenDiscussionWasDeleted(DiscussionDeleted $event) { $this->updateDiscussionsCount($event->discussion, -1); }