Fix some incorrect automated refactorings

This commit is contained in:
Franz Liedke 2017-06-24 14:10:39 +02:00
parent eb8c38af33
commit 8aab52327e
9 changed files with 19 additions and 20 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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(

View File

@ -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();

View File

@ -11,7 +11,7 @@
namespace Flarum\Discussion\Search\Fulltext;
use Flarum\Core\Post;
use Flarum\Post\Post;
class MySqlFulltextDriver implements DriverInterface
{

View File

@ -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
*/

View File

@ -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();

View File

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