mirror of
https://github.com/flarum/framework.git
synced 2025-04-27 23:24:03 +08:00
Merge pull request #831 from flarum/analysis-qvQMPx
Applied fixes from StyleCI
This commit is contained in:
commit
0ccfad3931
@ -8,7 +8,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
|
@ -10,17 +10,17 @@
|
||||
|
||||
namespace Flarum\Admin\Controller;
|
||||
|
||||
use Flarum\Api\Client;
|
||||
use Flarum\Core\Permission;
|
||||
use Flarum\Event\PrepareUnserializedSettings;
|
||||
use Flarum\Extension\ExtensionManager;
|
||||
use Flarum\Foundation\Application;
|
||||
use Flarum\Http\Controller\AbstractClientController as BaseClientController;
|
||||
use Flarum\Extension\ExtensionManager;
|
||||
use Flarum\Locale\LocaleManager;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Illuminate\Contracts\Cache\Repository;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Flarum\Core\Permission;
|
||||
use Flarum\Api\Client;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Flarum\Event\PrepareUnserializedSettings;
|
||||
|
||||
class ClientController extends BaseClientController
|
||||
{
|
||||
|
@ -13,12 +13,10 @@ namespace Flarum\Admin\Middleware;
|
||||
use Exception;
|
||||
use Flarum\Core\Access\AssertPermissionTrait;
|
||||
use Flarum\Forum\Controller\LogInController;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Zend\Diactoros\Response\HtmlResponse;
|
||||
use Zend\Diactoros\Response\RedirectResponse;
|
||||
use Zend\Stratigility\MiddlewareInterface;
|
||||
|
||||
class RequireAdministrateAbility implements MiddlewareInterface
|
||||
|
@ -25,12 +25,12 @@ class ShowDiscussionController extends AbstractResourceController
|
||||
protected $discussions;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $serializer = 'Flarum\Api\Serializer\DiscussionSerializer';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $include = [
|
||||
'posts',
|
||||
@ -42,7 +42,7 @@ class ShowDiscussionController extends AbstractResourceController
|
||||
];
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $optionalInclude = [
|
||||
'startUser',
|
||||
|
@ -68,9 +68,9 @@ class TokenController implements ControllerInterface
|
||||
$token = AccessToken::generate($user->id, $lifetime);
|
||||
$token->save();
|
||||
|
||||
return (new JsonResponse([
|
||||
return new JsonResponse([
|
||||
'token' => $token->id,
|
||||
'userId' => $user->id
|
||||
]));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ namespace Flarum\Api\Serializer;
|
||||
|
||||
use Closure;
|
||||
use DateTime;
|
||||
use Flarum\Api\Relationship\HasManyBuilder;
|
||||
use Flarum\Api\Relationship\HasOneBuilder;
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Event\GetApiRelationship;
|
||||
use Flarum\Event\PrepareApiAttributes;
|
||||
@ -24,7 +22,6 @@ use LogicException;
|
||||
use Tobscure\JsonApi\AbstractSerializer as BaseAbstractSerializer;
|
||||
use Tobscure\JsonApi\Collection;
|
||||
use Tobscure\JsonApi\Relationship;
|
||||
use Tobscure\JsonApi\Relationship\BuilderInterface;
|
||||
use Tobscure\JsonApi\Resource;
|
||||
use Tobscure\JsonApi\SerializerInterface;
|
||||
|
||||
|
@ -53,7 +53,7 @@ class JsCompiler extends RevisionCompiler
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getCacheDifferentiator()
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ class RevisionCompiler implements CompilerInterface
|
||||
*/
|
||||
protected function getCacheDifferentiator()
|
||||
{
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,10 +10,8 @@
|
||||
|
||||
namespace Flarum\Console\Command;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Question\Question;
|
||||
use Flarum\Foundation\Application;
|
||||
use Symfony\Component\Console\Question\Question;
|
||||
|
||||
class GenerateExtensionCommand extends AbstractCommand
|
||||
{
|
||||
@ -21,7 +19,7 @@ class GenerateExtensionCommand extends AbstractCommand
|
||||
{
|
||||
$this
|
||||
->setName('generate:extension')
|
||||
->setDescription("Generate a Flarum extension skeleton.");
|
||||
->setDescription('Generate a Flarum extension skeleton.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,10 +10,9 @@
|
||||
|
||||
namespace Flarum\Console\Command;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Question\Question;
|
||||
use Flarum\Database\MigrationCreator;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class GenerateMigrationCommand extends AbstractCommand
|
||||
{
|
||||
@ -39,7 +38,7 @@ class GenerateMigrationCommand extends AbstractCommand
|
||||
{
|
||||
$this
|
||||
->setName('generate:migration')
|
||||
->setDescription("Generate a migration.")
|
||||
->setDescription('Generate a migration.')
|
||||
->addArgument(
|
||||
'name',
|
||||
InputArgument::REQUIRED,
|
||||
|
@ -1,5 +1,14 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Core\Access;
|
||||
|
||||
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
|
||||
|
@ -45,7 +45,7 @@ class PostPolicy extends AbstractPolicy
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ class EditDiscussion
|
||||
/**
|
||||
* The ID of the discussion to edit.
|
||||
*
|
||||
* @var integer
|
||||
* @var int
|
||||
*/
|
||||
public $discussionId;
|
||||
|
||||
@ -36,7 +36,7 @@ class EditDiscussion
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* @param integer $discussionId The ID of the discussion to edit.
|
||||
* @param int $discussionId The ID of the discussion to edit.
|
||||
* @param \Flarum\Core\User $actor The user performing the action.
|
||||
* @param array $data The attributes to update on the discussion.
|
||||
*/
|
||||
|
@ -11,7 +11,6 @@
|
||||
namespace Flarum\Core\Command;
|
||||
|
||||
use Flarum\Core\Access\AssertPermissionTrait;
|
||||
use Flarum\Core\Notification;
|
||||
use Flarum\Core\Repository\NotificationRepository;
|
||||
|
||||
class ReadAllNotificationsHandler
|
||||
|
@ -17,7 +17,7 @@ class ReadDiscussion
|
||||
/**
|
||||
* The ID of the discussion to mark as read.
|
||||
*
|
||||
* @var integer
|
||||
* @var int
|
||||
*/
|
||||
public $discussionId;
|
||||
|
||||
@ -31,14 +31,14 @@ class ReadDiscussion
|
||||
/**
|
||||
* The number of the post to mark as read.
|
||||
*
|
||||
* @var integer
|
||||
* @var int
|
||||
*/
|
||||
public $readNumber;
|
||||
|
||||
/**
|
||||
* @param integer $discussionId The ID of the discussion to mark as read.
|
||||
* @param int $discussionId The ID of the discussion to mark as read.
|
||||
* @param User $actor The user to mark the discussion as read for.
|
||||
* @param integer $readNumber The number of the post to mark as read.
|
||||
* @param int $readNumber The number of the post to mark as read.
|
||||
*/
|
||||
public function __construct($discussionId, User $actor, $readNumber)
|
||||
{
|
||||
|
@ -174,6 +174,6 @@ class RegisterUserHandler
|
||||
|
||||
$user->changeAvatarPath($uploadName);
|
||||
|
||||
$mount->move("source://".pathinfo($tmpFile, PATHINFO_BASENAME), "target://$uploadName");
|
||||
$mount->move('source://'.pathinfo($tmpFile, PATHINFO_BASENAME), "target://$uploadName");
|
||||
}
|
||||
}
|
||||
|
@ -10,14 +10,14 @@
|
||||
|
||||
namespace Flarum\Core\Command;
|
||||
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Flarum\Core;
|
||||
use Flarum\Core\PasswordToken;
|
||||
use Flarum\Core\Repository\UserRepository;
|
||||
use Illuminate\Contracts\Mail\Mailer;
|
||||
use Illuminate\Mail\Message;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Flarum\Core;
|
||||
use Flarum\Forum\UrlGenerator;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Illuminate\Contracts\Mail\Mailer;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Mail\Message;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
class RequestPasswordResetHandler
|
||||
|
@ -115,7 +115,7 @@ class UploadAvatarHandler
|
||||
|
||||
$user->changeAvatarPath($uploadName);
|
||||
|
||||
$mount->move("source://".pathinfo($tmpFile, PATHINFO_BASENAME), "target://$uploadName");
|
||||
$mount->move('source://'.pathinfo($tmpFile, PATHINFO_BASENAME), "target://$uploadName");
|
||||
|
||||
$user->save();
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
namespace Flarum\Core;
|
||||
|
||||
use Flarum\Core\Post;
|
||||
use Flarum\Core\Post\MergeableInterface;
|
||||
use Flarum\Core\Support\EventGeneratorTrait;
|
||||
use Flarum\Core\Support\ScopeVisibilityTrait;
|
||||
|
@ -11,9 +11,9 @@
|
||||
namespace Flarum\Core\Listener;
|
||||
|
||||
use Flarum\Core\Post;
|
||||
use Flarum\Event\PostWasPosted;
|
||||
use Flarum\Event\PostWasDeleted;
|
||||
use Flarum\Event\PostWasHidden;
|
||||
use Flarum\Event\PostWasPosted;
|
||||
use Flarum\Event\PostWasRestored;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
|
@ -10,10 +10,10 @@
|
||||
|
||||
namespace Flarum\Core\Listener;
|
||||
|
||||
use Flarum\Event\DiscussionWasRenamed;
|
||||
use Flarum\Core\Post\DiscussionRenamedPost;
|
||||
use Flarum\Core\Notification\DiscussionRenamedBlueprint;
|
||||
use Flarum\Core\Notification\NotificationSyncer;
|
||||
use Flarum\Core\Post\DiscussionRenamedPost;
|
||||
use Flarum\Event\DiscussionWasRenamed;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class DiscussionRenamedNotifier
|
||||
|
@ -10,14 +10,14 @@
|
||||
|
||||
namespace Flarum\Core\Listener;
|
||||
|
||||
use Flarum\Core\Post;
|
||||
use Flarum\Core\Discussion;
|
||||
use Flarum\Event\PostWasPosted;
|
||||
use Flarum\Core\Post;
|
||||
use Flarum\Event\DiscussionWasDeleted;
|
||||
use Flarum\Event\DiscussionWasStarted;
|
||||
use Flarum\Event\PostWasDeleted;
|
||||
use Flarum\Event\PostWasHidden;
|
||||
use Flarum\Event\PostWasPosted;
|
||||
use Flarum\Event\PostWasRestored;
|
||||
use Flarum\Event\DiscussionWasStarted;
|
||||
use Flarum\Event\DiscussionWasDeleted;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class UserMetadataUpdater
|
||||
|
@ -14,7 +14,6 @@ use Flarum\Core\Notification;
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Event\ConfigureNotificationTypes;
|
||||
use Flarum\Foundation\AbstractServiceProvider;
|
||||
use Flarum\Extend;
|
||||
use ReflectionClass;
|
||||
|
||||
class NotificationServiceProvider extends AbstractServiceProvider
|
||||
|
@ -10,11 +10,11 @@
|
||||
|
||||
namespace Flarum\Core\Notification;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Core\Notification;
|
||||
use Flarum\Core\Repository\NotificationRepository;
|
||||
use Flarum\Event\NotificationWillBeSent;
|
||||
use Flarum\Core\User;
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Event\NotificationWillBeSent;
|
||||
|
||||
/**
|
||||
* The Notification Syncer commits notification blueprints to the database, and
|
||||
|
@ -10,12 +10,9 @@
|
||||
|
||||
namespace Flarum\Core;
|
||||
|
||||
use DomainException;
|
||||
use Flarum\Core\Post\RegisteredTypesScope;
|
||||
use Flarum\Core\Support\EventGeneratorTrait;
|
||||
use Flarum\Core\Support\Locked;
|
||||
use Flarum\Core\Support\ScopeVisibilityTrait;
|
||||
use Flarum\Core\Support\ValidateBeforeSaveTrait;
|
||||
use Flarum\Database\AbstractModel;
|
||||
use Flarum\Event\PostWasDeleted;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@ -99,7 +96,7 @@ class Post extends AbstractModel
|
||||
* Determine whether or not this post is visible to the given user.
|
||||
*
|
||||
* @param User $user
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isVisibleTo(User $user)
|
||||
{
|
||||
|
@ -21,12 +21,12 @@ use Flarum\Core\Post;
|
||||
class DiscussionRenamedPost extends AbstractEventPost implements MergeableInterface
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $type = 'discussionRenamed';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function saveAfter(Post $previous)
|
||||
{
|
||||
|
@ -11,8 +11,8 @@
|
||||
namespace Flarum\Core\Repository;
|
||||
|
||||
use Flarum\Core\Discussion;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Flarum\Core\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
|
||||
class DiscussionRepository
|
||||
@ -31,7 +31,7 @@ class DiscussionRepository
|
||||
* Find a discussion by ID, optionally making sure it is visible to a
|
||||
* certain user, or throw an exception.
|
||||
*
|
||||
* @param integer $id
|
||||
* @param int $id
|
||||
* @param User $user
|
||||
* @return \Flarum\Core\Discussion
|
||||
*/
|
||||
|
@ -10,11 +10,11 @@
|
||||
|
||||
namespace Flarum\Core\Repository;
|
||||
|
||||
use Flarum\Core\Discussion;
|
||||
use Flarum\Core\Post;
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Event\ScopePostVisibility;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Core\Discussion;
|
||||
|
||||
class PostRepository
|
||||
{
|
||||
@ -32,7 +32,7 @@ class PostRepository
|
||||
* Find a post by ID, optionally making sure it is visible to a certain
|
||||
* user, or throw an exception.
|
||||
*
|
||||
* @param integer $id
|
||||
* @param int $id
|
||||
* @param \Flarum\Core\User $actor
|
||||
* @return \Flarum\Core\Post
|
||||
*
|
||||
@ -56,8 +56,8 @@ class PostRepository
|
||||
* @param array $where
|
||||
* @param \Flarum\Core\User|null $actor
|
||||
* @param array $sort
|
||||
* @param integer $count
|
||||
* @param integer $start
|
||||
* @param int $count
|
||||
* @param int $start
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public function findWhere(array $where = [], User $actor = null, $sort = [], $count = null, $start = 0)
|
||||
@ -118,10 +118,10 @@ class PostRepository
|
||||
* is. If the post with that number does not exist, the index of the
|
||||
* closest post to it will be returned.
|
||||
*
|
||||
* @param integer $discussionId
|
||||
* @param integer $number
|
||||
* @param int $discussionId
|
||||
* @param int $number
|
||||
* @param \Flarum\Core\User|null $actor
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function getIndexForNumber($discussionId, $number, User $actor = null)
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ class UserRepository
|
||||
*
|
||||
* @param string $username
|
||||
* @param User|null $actor
|
||||
* @return integer|null
|
||||
* @return int|null
|
||||
*/
|
||||
public function getIdForUsername($username, User $actor = null)
|
||||
{
|
||||
|
@ -27,10 +27,10 @@ abstract class AbstractRegexGambit implements GambitInterface
|
||||
if ($matches = $this->match($bit)) {
|
||||
list($negate) = array_splice($matches, 1, 1);
|
||||
|
||||
$this->conditions($search, $matches, !! $negate);
|
||||
$this->conditions($search, $matches, (bool) $negate);
|
||||
}
|
||||
|
||||
return !! $matches;
|
||||
return (bool) $matches;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -11,13 +11,13 @@
|
||||
namespace Flarum\Core\Search\Discussion;
|
||||
|
||||
use Flarum\Core\Discussion;
|
||||
use Flarum\Core\Search\ApplySearchParametersTrait;
|
||||
use Flarum\Core\Search\SearchCriteria;
|
||||
use Flarum\Core\Search\GambitManager;
|
||||
use Flarum\Core\Repository\DiscussionRepository;
|
||||
use Flarum\Core\Repository\PostRepository;
|
||||
use Flarum\Event\ConfigureDiscussionSearch;
|
||||
use Flarum\Core\Search\ApplySearchParametersTrait;
|
||||
use Flarum\Core\Search\GambitManager;
|
||||
use Flarum\Core\Search\SearchCriteria;
|
||||
use Flarum\Core\Search\SearchResults;
|
||||
use Flarum\Event\ConfigureDiscussionSearch;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
/**
|
||||
|
@ -10,10 +10,10 @@
|
||||
|
||||
namespace Flarum\Core\Search\Discussion\Gambit;
|
||||
|
||||
use Flarum\Core\Search\Discussion\DiscussionSearch;
|
||||
use Flarum\Core\Repository\UserRepository;
|
||||
use Flarum\Core\Search\AbstractRegexGambit;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Core\Search\Discussion\DiscussionSearch;
|
||||
use LogicException;
|
||||
|
||||
class AuthorGambit extends AbstractRegexGambit
|
||||
|
@ -10,9 +10,9 @@
|
||||
|
||||
namespace Flarum\Core\Search\Discussion\Gambit;
|
||||
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Core\Search\Discussion\DiscussionSearch;
|
||||
use Flarum\Core\Search\Discussion\Fulltext\DriverInterface;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Core\Search\GambitInterface;
|
||||
use LogicException;
|
||||
|
||||
|
@ -10,9 +10,9 @@
|
||||
|
||||
namespace Flarum\Core\Search\Discussion\Gambit;
|
||||
|
||||
use Flarum\Core\Search\Discussion\DiscussionSearch;
|
||||
use Flarum\Core\Search\AbstractRegexGambit;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Core\Search\Discussion\DiscussionSearch;
|
||||
use LogicException;
|
||||
|
||||
class HiddenGambit extends AbstractRegexGambit
|
||||
|
@ -11,9 +11,9 @@
|
||||
namespace Flarum\Core\Search\Discussion\Gambit;
|
||||
|
||||
use Flarum\Core\Repository\DiscussionRepository;
|
||||
use Flarum\Core\Search\Discussion\DiscussionSearch;
|
||||
use Flarum\Core\Search\AbstractRegexGambit;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Core\Search\Discussion\DiscussionSearch;
|
||||
use LogicException;
|
||||
|
||||
class UnreadGambit extends AbstractRegexGambit
|
||||
|
@ -10,10 +10,10 @@
|
||||
|
||||
namespace Flarum\Core\Search\User\Gambit;
|
||||
|
||||
use Flarum\Core\Search\User\UserSearch;
|
||||
use Flarum\Core\Repository\UserRepository;
|
||||
use Flarum\Core\Search\AbstractRegexGambit;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Core\Search\User\UserSearch;
|
||||
use LogicException;
|
||||
|
||||
class EmailGambit extends AbstractRegexGambit
|
||||
|
@ -10,11 +10,11 @@
|
||||
|
||||
namespace Flarum\Core\Search\User;
|
||||
|
||||
use Flarum\Core\Repository\UserRepository;
|
||||
use Flarum\Core\Search\ApplySearchParametersTrait;
|
||||
use Flarum\Core\Search\GambitManager;
|
||||
use Flarum\Core\Search\SearchCriteria;
|
||||
use Flarum\Core\Search\SearchResults;
|
||||
use Flarum\Core\Repository\UserRepository;
|
||||
use Flarum\Event\ConfigureUserSearch;
|
||||
|
||||
/**
|
||||
|
@ -10,9 +10,9 @@
|
||||
|
||||
namespace Flarum\Core\Support;
|
||||
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Event\ScopeModelVisibility;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Flarum\Core\User;
|
||||
|
||||
trait ScopeVisibilityTrait
|
||||
{
|
||||
|
@ -11,9 +11,7 @@
|
||||
namespace Flarum\Core;
|
||||
|
||||
use DomainException;
|
||||
use Flarum\Core;
|
||||
use Flarum\Core\Access\Gate;
|
||||
use Flarum\Core\Notification;
|
||||
use Flarum\Core\Support\EventGeneratorTrait;
|
||||
use Flarum\Core\Support\ScopeVisibilityTrait;
|
||||
use Flarum\Database\AbstractModel;
|
||||
@ -79,7 +77,7 @@ class User extends AbstractModel
|
||||
|
||||
/**
|
||||
* An array of registered user preferences. Each preference is defined with
|
||||
* a key, and its value is an array containing the following keys:
|
||||
* a key, and its value is an array containing the following keys:.
|
||||
*
|
||||
* - transformer: a callback that confines the value of the preference
|
||||
* - default: a default value if the preference isn't set
|
||||
@ -338,7 +336,7 @@ class User extends AbstractModel
|
||||
* Check if a given password matches the user's password.
|
||||
*
|
||||
* @param string $password
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function checkPassword($password)
|
||||
{
|
||||
@ -365,7 +363,7 @@ class User extends AbstractModel
|
||||
* Check whether the user has a certain permission based on their groups.
|
||||
*
|
||||
* @param string $permission
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function hasPermission($permission)
|
||||
{
|
||||
@ -385,7 +383,7 @@ class User extends AbstractModel
|
||||
* based on their groups.
|
||||
*
|
||||
* @param string $match
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function hasPermissionLike($match)
|
||||
{
|
||||
@ -430,7 +428,7 @@ class User extends AbstractModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all notifications that have not been read yet
|
||||
* Get all notifications that have not been read yet.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
|
@ -28,7 +28,7 @@ abstract class AbstractModel extends Eloquent
|
||||
/**
|
||||
* Indicates if the model should be timestamped. Turn off by default.
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
namespace Flarum\Database;
|
||||
|
||||
use Flarum\Core;
|
||||
use Flarum\Foundation\AbstractServiceProvider;
|
||||
use Flarum\Foundation\Application;
|
||||
use Illuminate\Database\ConnectionResolver;
|
||||
|
@ -13,7 +13,7 @@ namespace Flarum\Event;
|
||||
use Flarum\Core\User;
|
||||
|
||||
/**
|
||||
* The `PrepareUserGroups` event
|
||||
* The `PrepareUserGroups` event.
|
||||
*/
|
||||
class PrepareUserGroups
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ use Flarum\Core\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
/**
|
||||
* The `ScopeHiddenDiscussionVisibility` event
|
||||
* The `ScopeHiddenDiscussionVisibility` event.
|
||||
*/
|
||||
class ScopeHiddenDiscussionVisibility
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ use Flarum\Core\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
/**
|
||||
* The `ScopePostVisibility` event
|
||||
* The `ScopePostVisibility` event.
|
||||
*/
|
||||
class ScopePostVisibility
|
||||
{
|
||||
|
@ -116,7 +116,6 @@ class Extension implements Arrayable
|
||||
return isset($this->{$name}) || $this->composerJsonAttribute(Str::snake($name, '-'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Dot notation getter for composer.json attributes.
|
||||
*
|
||||
@ -131,7 +130,7 @@ class Extension implements Arrayable
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $installed
|
||||
* @param bool $installed
|
||||
* @return Extension
|
||||
*/
|
||||
public function setInstalled($installed)
|
||||
@ -142,7 +141,7 @@ class Extension implements Arrayable
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isInstalled()
|
||||
{
|
||||
@ -194,7 +193,7 @@ class Extension implements Arrayable
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $enabled
|
||||
* @param bool $enabled
|
||||
* @return Extension
|
||||
*/
|
||||
public function setEnabled($enabled)
|
||||
@ -205,7 +204,7 @@ class Extension implements Arrayable
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
namespace Flarum\Extension;
|
||||
|
||||
use Flarum\Core;
|
||||
use Flarum\Database\Migrator;
|
||||
use Flarum\Event\ExtensionWasDisabled;
|
||||
use Flarum\Event\ExtensionWasEnabled;
|
||||
@ -19,7 +18,6 @@ use Flarum\Foundation\Application;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class ExtensionManager
|
||||
|
@ -14,7 +14,6 @@ use Flarum\Forum\AuthenticationResponseFactory;
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Zend\Diactoros\Response\HtmlResponse;
|
||||
use Zend\Diactoros\Response\RedirectResponse;
|
||||
|
||||
abstract class AbstractOAuth2Controller implements ControllerInterface
|
||||
|
@ -10,9 +10,8 @@
|
||||
|
||||
namespace Flarum\Forum\Controller;
|
||||
|
||||
use Flarum\Core\User;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Flarum\Core\Exception\PermissionDeniedException;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
class AuthorizedClientController extends ClientController
|
||||
{
|
||||
|
@ -13,9 +13,9 @@ namespace Flarum\Forum\Controller;
|
||||
use Flarum\Api\Client;
|
||||
use Flarum\Formatter\Formatter;
|
||||
use Flarum\Foundation\Application;
|
||||
use Flarum\Http\Controller\AbstractClientController;
|
||||
use Flarum\Locale\LocaleManager;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Flarum\Http\Controller\AbstractClientController;
|
||||
use Illuminate\Contracts\Cache\Repository;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
@ -55,7 +55,7 @@ class ClientController extends AbstractClientController
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getAssets()
|
||||
{
|
||||
|
@ -11,8 +11,8 @@
|
||||
namespace Flarum\Forum\Controller;
|
||||
|
||||
use Flarum\Core\User;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Flarum\Http\Exception\RouteNotFoundException;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
class DiscussionController extends ClientController
|
||||
{
|
||||
|
@ -12,9 +12,9 @@ namespace Flarum\Forum\Controller;
|
||||
|
||||
use Flarum\Api\Client;
|
||||
use Flarum\Api\Controller\TokenController;
|
||||
use Flarum\Http\AccessToken;
|
||||
use Flarum\Event\UserLoggedIn;
|
||||
use Flarum\Core\Repository\UserRepository;
|
||||
use Flarum\Event\UserLoggedIn;
|
||||
use Flarum\Http\AccessToken;
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use Flarum\Http\Rememberer;
|
||||
use Flarum\Http\SessionAuthenticator;
|
||||
|
@ -11,7 +11,6 @@
|
||||
namespace Flarum\Forum\Controller;
|
||||
|
||||
use Flarum\Api\Client;
|
||||
use Flarum\Http\AccessToken;
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use Flarum\Http\Rememberer;
|
||||
use Flarum\Http\SessionAuthenticator;
|
||||
|
@ -10,12 +10,12 @@
|
||||
|
||||
namespace Flarum\Forum\Controller;
|
||||
|
||||
use DateTime;
|
||||
use Flarum\Core\Exception\InvalidConfirmationTokenException;
|
||||
use Flarum\Core\PasswordToken;
|
||||
use Flarum\Http\Controller\AbstractHtmlController;
|
||||
use Flarum\Core\Exception\InvalidConfirmationTokenException;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use DateTime;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
class ResetPasswordController extends AbstractHtmlController
|
||||
{
|
||||
|
@ -11,7 +11,6 @@
|
||||
namespace Flarum\Forum\Controller;
|
||||
|
||||
use Flarum\Core\PasswordToken;
|
||||
use Flarum\Core\Command\EditUser;
|
||||
use Flarum\Forum\UrlGenerator;
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use Flarum\Http\SessionAuthenticator;
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
namespace Flarum\Foundation;
|
||||
|
||||
use Flarum\Core;
|
||||
use Illuminate\Config\Repository as ConfigRepository;
|
||||
use Monolog\Formatter\LineFormatter;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
|
@ -14,7 +14,6 @@ use Flarum\Api\Client;
|
||||
use Flarum\Asset\AssetManager;
|
||||
use Flarum\Asset\JsCompiler;
|
||||
use Flarum\Asset\LessCompiler;
|
||||
use Flarum\Core;
|
||||
use Flarum\Event\ConfigureClientView;
|
||||
use Flarum\Foundation\Application;
|
||||
use Flarum\Locale\JsCompiler as LocaleJsCompiler;
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
namespace Flarum\Http\Controller;
|
||||
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Zend\Diactoros\Response;
|
||||
|
||||
|
@ -13,9 +13,9 @@ namespace Flarum\Http\Controller;
|
||||
use Flarum\Api\Client;
|
||||
use Flarum\Asset\AssetManager;
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Locale\JsCompiler;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Flarum\Locale\JsCompiler;
|
||||
|
||||
/**
|
||||
* This class represents a view which boots up Flarum's client.
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
namespace Flarum\Http\Middleware;
|
||||
|
||||
use DateTime;
|
||||
use Flarum\Api\ApiKey;
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Http\AccessToken;
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace Flarum\Http\Middleware;
|
||||
|
||||
use FastRoute\Dispatcher;
|
||||
use FastRoute\RouteParser;
|
||||
use Flarum\Http\Exception\MethodNotAllowedException;
|
||||
use Flarum\Http\Exception\RouteNotFoundException;
|
||||
use Flarum\Http\RouteCollection;
|
||||
|
@ -10,11 +10,11 @@
|
||||
|
||||
namespace Flarum\Http\Middleware;
|
||||
|
||||
use Franzl\Middleware\Whoops\ErrorMiddleware as WhoopsMiddleware;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Zend\Diactoros\Response\HtmlResponse;
|
||||
use Zend\Stratigility\ErrorMiddlewareInterface;
|
||||
use Franzl\Middleware\Whoops\ErrorMiddleware as WhoopsMiddleware;
|
||||
|
||||
class HandleErrors implements ErrorMiddlewareInterface
|
||||
{
|
||||
|
@ -10,9 +10,9 @@
|
||||
|
||||
namespace Flarum\Install\Console;
|
||||
|
||||
use Exception;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
use Exception;
|
||||
|
||||
class FileDataProvider implements DataProviderInterface
|
||||
{
|
||||
|
@ -10,21 +10,17 @@
|
||||
|
||||
namespace Flarum\Install\Console;
|
||||
|
||||
use Exception;
|
||||
use Flarum\Console\Command\AbstractCommand;
|
||||
use Flarum\Database\AbstractModel;
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Core\Group;
|
||||
use Flarum\Core\Permission;
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Database\AbstractModel;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Validation\Factory;
|
||||
use PDO;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Exception;
|
||||
|
||||
class InstallCommand extends AbstractCommand
|
||||
{
|
||||
@ -77,7 +73,7 @@ class InstallCommand extends AbstractCommand
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function fire()
|
||||
{
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
namespace Flarum\Install\Console;
|
||||
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@ -26,7 +25,6 @@ class UserDataProvider implements DataProviderInterface
|
||||
|
||||
protected $baseUrl;
|
||||
|
||||
|
||||
public function __construct(InputInterface $input, OutputInterface $output, QuestionHelper $questionHelper)
|
||||
{
|
||||
$this->input = $input;
|
||||
|
@ -10,10 +10,10 @@
|
||||
|
||||
namespace Flarum\Install\Controller;
|
||||
|
||||
use Flarum\Install\Prerequisite\PrerequisiteInterface;
|
||||
use Flarum\Http\Controller\AbstractHtmlController;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Flarum\Install\Prerequisite\PrerequisiteInterface;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
class IndexController extends AbstractHtmlController
|
||||
{
|
||||
|
@ -10,19 +10,16 @@
|
||||
|
||||
namespace Flarum\Install\Controller;
|
||||
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use Flarum\Http\AccessToken;
|
||||
use Flarum\Http\SessionAuthenticator;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Zend\Diactoros\Response\HtmlResponse;
|
||||
use Zend\Diactoros\Response;
|
||||
use Flarum\Install\Console\InstallCommand;
|
||||
use Flarum\Install\Console\DefaultsDataProvider;
|
||||
use Symfony\Component\Console\Output\StreamOutput;
|
||||
use Symfony\Component\Console\Input\StringInput;
|
||||
use Exception;
|
||||
use DateTime;
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use Flarum\Http\SessionAuthenticator;
|
||||
use Flarum\Install\Console\DefaultsDataProvider;
|
||||
use Flarum\Install\Console\InstallCommand;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Symfony\Component\Console\Input\StringInput;
|
||||
use Symfony\Component\Console\Output\StreamOutput;
|
||||
use Zend\Diactoros\Response;
|
||||
use Zend\Diactoros\Response\HtmlResponse;
|
||||
|
||||
class InstallController implements ControllerInterface
|
||||
{
|
||||
|
@ -32,9 +32,9 @@ class JsCompiler extends BaseJsCompiler
|
||||
$output .= file_get_contents($filename);
|
||||
}
|
||||
|
||||
$output .= "}
|
||||
$output .= '}
|
||||
};
|
||||
});";
|
||||
});';
|
||||
|
||||
return $this->format($output);
|
||||
}
|
||||
|
@ -12,10 +12,6 @@ namespace Flarum\Update\Console;
|
||||
|
||||
use Flarum\Console\Command\AbstractCommand;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class MigrateCommand extends AbstractCommand
|
||||
{
|
||||
@ -41,7 +37,7 @@ class MigrateCommand extends AbstractCommand
|
||||
{
|
||||
$this
|
||||
->setName('migrate')
|
||||
->setDescription("Run outstanding migrations.");
|
||||
->setDescription('Run outstanding migrations.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -11,8 +11,8 @@
|
||||
namespace Flarum\Update\Controller;
|
||||
|
||||
use Flarum\Http\Controller\AbstractHtmlController;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
class IndexController extends AbstractHtmlController
|
||||
{
|
||||
|
@ -1,4 +1,14 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Tests\Flarum\Core\Settings;
|
||||
|
||||
use Flarum\Settings\DatabaseSettingsRepository;
|
||||
@ -19,14 +29,14 @@ class DatabaseSettingsRepositoryTest extends TestCase
|
||||
|
||||
public function test_requesting_an_existing_setting_should_return_its_value()
|
||||
{
|
||||
$this->connection->shouldReceive("table->where->value")->andReturn('value');
|
||||
$this->connection->shouldReceive('table->where->value')->andReturn('value');
|
||||
|
||||
$this->assertEquals('value', $this->repository->get('key'));
|
||||
}
|
||||
|
||||
public function test_non_existent_setting_values_should_return_null()
|
||||
{
|
||||
$this->connection->shouldReceive("table->where->value")->andReturn(null);
|
||||
$this->connection->shouldReceive('table->where->value')->andReturn(null);
|
||||
|
||||
$this->assertEquals('default', $this->repository->get('key', 'default'));
|
||||
}
|
||||
|
@ -1,4 +1,14 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Tests\Flarum\Core\Settings;
|
||||
|
||||
use Flarum\Settings\MemoryCacheSettingsRepository;
|
||||
|
@ -1,4 +1,14 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Tests\Test;
|
||||
|
||||
use Mockery;
|
||||
|
Loading…
x
Reference in New Issue
Block a user