1
0
mirror of https://github.com/flarum/core.git synced 2025-07-16 14:26:25 +02:00

Applied fixes from StyleCI

This commit is contained in:
Toby Zerner
2016-02-25 22:09:39 -05:00
committed by StyleCI Bot
parent 83c22d73a4
commit a6cf10f854
96 changed files with 240 additions and 245 deletions

View File

@ -8,7 +8,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder; use Illuminate\Database\Schema\Builder;

View File

@ -8,7 +8,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder; use Illuminate\Database\Schema\Builder;

View File

@ -10,17 +10,17 @@
namespace Flarum\Admin\Controller; 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\Foundation\Application;
use Flarum\Http\Controller\AbstractClientController as BaseClientController; use Flarum\Http\Controller\AbstractClientController as BaseClientController;
use Flarum\Extension\ExtensionManager;
use Flarum\Locale\LocaleManager; use Flarum\Locale\LocaleManager;
use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Contracts\Cache\Repository; use Illuminate\Contracts\Cache\Repository;
use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Events\Dispatcher;
use Psr\Http\Message\ServerRequestInterface as Request; 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 class ClientController extends BaseClientController
{ {

View File

@ -13,12 +13,10 @@ namespace Flarum\Admin\Middleware;
use Exception; use Exception;
use Flarum\Core\Access\AssertPermissionTrait; use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\Forum\Controller\LogInController; use Flarum\Forum\Controller\LogInController;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\Factory;
use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request; use Psr\Http\Message\ServerRequestInterface as Request;
use Zend\Diactoros\Response\HtmlResponse; use Zend\Diactoros\Response\HtmlResponse;
use Zend\Diactoros\Response\RedirectResponse;
use Zend\Stratigility\MiddlewareInterface; use Zend\Stratigility\MiddlewareInterface;
class RequireAdministrateAbility implements MiddlewareInterface class RequireAdministrateAbility implements MiddlewareInterface

View File

@ -25,12 +25,12 @@ class ShowDiscussionController extends AbstractResourceController
protected $discussions; protected $discussions;
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public $serializer = 'Flarum\Api\Serializer\DiscussionSerializer'; public $serializer = 'Flarum\Api\Serializer\DiscussionSerializer';
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public $include = [ public $include = [
'posts', 'posts',
@ -42,7 +42,7 @@ class ShowDiscussionController extends AbstractResourceController
]; ];
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public $optionalInclude = [ public $optionalInclude = [
'startUser', 'startUser',

View File

@ -68,9 +68,9 @@ class TokenController implements ControllerInterface
$token = AccessToken::generate($user->id, $lifetime); $token = AccessToken::generate($user->id, $lifetime);
$token->save(); $token->save();
return (new JsonResponse([ return new JsonResponse([
'token' => $token->id, 'token' => $token->id,
'userId' => $user->id 'userId' => $user->id
])); ]);
} }
} }

View File

@ -12,8 +12,6 @@ namespace Flarum\Api\Serializer;
use Closure; use Closure;
use DateTime; use DateTime;
use Flarum\Api\Relationship\HasManyBuilder;
use Flarum\Api\Relationship\HasOneBuilder;
use Flarum\Core\User; use Flarum\Core\User;
use Flarum\Event\GetApiRelationship; use Flarum\Event\GetApiRelationship;
use Flarum\Event\PrepareApiAttributes; use Flarum\Event\PrepareApiAttributes;
@ -24,7 +22,6 @@ use LogicException;
use Tobscure\JsonApi\AbstractSerializer as BaseAbstractSerializer; use Tobscure\JsonApi\AbstractSerializer as BaseAbstractSerializer;
use Tobscure\JsonApi\Collection; use Tobscure\JsonApi\Collection;
use Tobscure\JsonApi\Relationship; use Tobscure\JsonApi\Relationship;
use Tobscure\JsonApi\Relationship\BuilderInterface;
use Tobscure\JsonApi\Resource; use Tobscure\JsonApi\Resource;
use Tobscure\JsonApi\SerializerInterface; use Tobscure\JsonApi\SerializerInterface;

View File

@ -53,7 +53,7 @@ class JsCompiler extends RevisionCompiler
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
protected function getCacheDifferentiator() protected function getCacheDifferentiator()
{ {

View File

@ -104,7 +104,7 @@ class RevisionCompiler implements CompilerInterface
*/ */
protected function getCacheDifferentiator() protected function getCacheDifferentiator()
{ {
return null; return;
} }
/** /**

View File

@ -10,10 +10,8 @@
namespace Flarum\Console\Command; 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 Flarum\Foundation\Application;
use Symfony\Component\Console\Question\Question;
class GenerateExtensionCommand extends AbstractCommand class GenerateExtensionCommand extends AbstractCommand
{ {
@ -21,7 +19,7 @@ class GenerateExtensionCommand extends AbstractCommand
{ {
$this $this
->setName('generate:extension') ->setName('generate:extension')
->setDescription("Generate a Flarum extension skeleton."); ->setDescription('Generate a Flarum extension skeleton.');
} }
/** /**

View File

@ -10,10 +10,9 @@
namespace Flarum\Console\Command; 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 Flarum\Database\MigrationCreator;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
class GenerateMigrationCommand extends AbstractCommand class GenerateMigrationCommand extends AbstractCommand
{ {
@ -39,7 +38,7 @@ class GenerateMigrationCommand extends AbstractCommand
{ {
$this $this
->setName('generate:migration') ->setName('generate:migration')
->setDescription("Generate a migration.") ->setDescription('Generate a migration.')
->addArgument( ->addArgument(
'name', 'name',
InputArgument::REQUIRED, InputArgument::REQUIRED,

View File

@ -1,5 +1,14 @@
<?php <?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; namespace Flarum\Core\Access;
use Illuminate\Contracts\Auth\Access\Gate as GateContract; use Illuminate\Contracts\Auth\Access\Gate as GateContract;

View File

@ -45,7 +45,7 @@ class PostPolicy extends AbstractPolicy
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function subscribe(Dispatcher $events) public function subscribe(Dispatcher $events)
{ {

View File

@ -17,7 +17,7 @@ class EditDiscussion
/** /**
* The ID of the discussion to edit. * The ID of the discussion to edit.
* *
* @var integer * @var int
*/ */
public $discussionId; public $discussionId;
@ -36,7 +36,7 @@ class EditDiscussion
public $data; 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 \Flarum\Core\User $actor The user performing the action.
* @param array $data The attributes to update on the discussion. * @param array $data The attributes to update on the discussion.
*/ */

View File

@ -11,7 +11,6 @@
namespace Flarum\Core\Command; namespace Flarum\Core\Command;
use Flarum\Core\Access\AssertPermissionTrait; use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\Core\Notification;
use Flarum\Core\Repository\NotificationRepository; use Flarum\Core\Repository\NotificationRepository;
class ReadAllNotificationsHandler class ReadAllNotificationsHandler

View File

@ -17,7 +17,7 @@ class ReadDiscussion
/** /**
* The ID of the discussion to mark as read. * The ID of the discussion to mark as read.
* *
* @var integer * @var int
*/ */
public $discussionId; public $discussionId;
@ -31,14 +31,14 @@ class ReadDiscussion
/** /**
* The number of the post to mark as read. * The number of the post to mark as read.
* *
* @var integer * @var int
*/ */
public $readNumber; 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 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) public function __construct($discussionId, User $actor, $readNumber)
{ {

View File

@ -174,6 +174,6 @@ class RegisterUserHandler
$user->changeAvatarPath($uploadName); $user->changeAvatarPath($uploadName);
$mount->move("source://".pathinfo($tmpFile, PATHINFO_BASENAME), "target://$uploadName"); $mount->move('source://'.pathinfo($tmpFile, PATHINFO_BASENAME), "target://$uploadName");
} }
} }

View File

@ -10,14 +10,14 @@
namespace Flarum\Core\Command; namespace Flarum\Core\Command;
use Flarum\Settings\SettingsRepositoryInterface; use Flarum\Core;
use Flarum\Core\PasswordToken; use Flarum\Core\PasswordToken;
use Flarum\Core\Repository\UserRepository; 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\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; use Symfony\Component\Translation\TranslatorInterface;
class RequestPasswordResetHandler class RequestPasswordResetHandler

View File

@ -115,7 +115,7 @@ class UploadAvatarHandler
$user->changeAvatarPath($uploadName); $user->changeAvatarPath($uploadName);
$mount->move("source://".pathinfo($tmpFile, PATHINFO_BASENAME), "target://$uploadName"); $mount->move('source://'.pathinfo($tmpFile, PATHINFO_BASENAME), "target://$uploadName");
$user->save(); $user->save();

View File

@ -10,7 +10,6 @@
namespace Flarum\Core; namespace Flarum\Core;
use Flarum\Core\Post;
use Flarum\Core\Post\MergeableInterface; use Flarum\Core\Post\MergeableInterface;
use Flarum\Core\Support\EventGeneratorTrait; use Flarum\Core\Support\EventGeneratorTrait;
use Flarum\Core\Support\ScopeVisibilityTrait; use Flarum\Core\Support\ScopeVisibilityTrait;

View File

@ -11,9 +11,9 @@
namespace Flarum\Core\Listener; namespace Flarum\Core\Listener;
use Flarum\Core\Post; use Flarum\Core\Post;
use Flarum\Event\PostWasPosted;
use Flarum\Event\PostWasDeleted; use Flarum\Event\PostWasDeleted;
use Flarum\Event\PostWasHidden; use Flarum\Event\PostWasHidden;
use Flarum\Event\PostWasPosted;
use Flarum\Event\PostWasRestored; use Flarum\Event\PostWasRestored;
use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Events\Dispatcher;

View File

@ -10,10 +10,10 @@
namespace Flarum\Core\Listener; namespace Flarum\Core\Listener;
use Flarum\Event\DiscussionWasRenamed;
use Flarum\Core\Post\DiscussionRenamedPost;
use Flarum\Core\Notification\DiscussionRenamedBlueprint; use Flarum\Core\Notification\DiscussionRenamedBlueprint;
use Flarum\Core\Notification\NotificationSyncer; use Flarum\Core\Notification\NotificationSyncer;
use Flarum\Core\Post\DiscussionRenamedPost;
use Flarum\Event\DiscussionWasRenamed;
use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Events\Dispatcher;
class DiscussionRenamedNotifier class DiscussionRenamedNotifier

View File

@ -10,14 +10,14 @@
namespace Flarum\Core\Listener; namespace Flarum\Core\Listener;
use Flarum\Core\Post;
use Flarum\Core\Discussion; 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\PostWasDeleted;
use Flarum\Event\PostWasHidden; use Flarum\Event\PostWasHidden;
use Flarum\Event\PostWasPosted;
use Flarum\Event\PostWasRestored; use Flarum\Event\PostWasRestored;
use Flarum\Event\DiscussionWasStarted;
use Flarum\Event\DiscussionWasDeleted;
use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Events\Dispatcher;
class UserMetadataUpdater class UserMetadataUpdater

View File

@ -14,7 +14,6 @@ use Flarum\Core\Notification;
use Flarum\Core\User; use Flarum\Core\User;
use Flarum\Event\ConfigureNotificationTypes; use Flarum\Event\ConfigureNotificationTypes;
use Flarum\Foundation\AbstractServiceProvider; use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Extend;
use ReflectionClass; use ReflectionClass;
class NotificationServiceProvider extends AbstractServiceProvider class NotificationServiceProvider extends AbstractServiceProvider

View File

@ -10,11 +10,11 @@
namespace Flarum\Core\Notification; namespace Flarum\Core\Notification;
use Carbon\Carbon;
use Flarum\Core\Notification; use Flarum\Core\Notification;
use Flarum\Core\Repository\NotificationRepository; use Flarum\Core\Repository\NotificationRepository;
use Flarum\Event\NotificationWillBeSent;
use Flarum\Core\User; use Flarum\Core\User;
use Carbon\Carbon; use Flarum\Event\NotificationWillBeSent;
/** /**
* The Notification Syncer commits notification blueprints to the database, and * The Notification Syncer commits notification blueprints to the database, and

View File

@ -10,12 +10,9 @@
namespace Flarum\Core; namespace Flarum\Core;
use DomainException;
use Flarum\Core\Post\RegisteredTypesScope; use Flarum\Core\Post\RegisteredTypesScope;
use Flarum\Core\Support\EventGeneratorTrait; use Flarum\Core\Support\EventGeneratorTrait;
use Flarum\Core\Support\Locked;
use Flarum\Core\Support\ScopeVisibilityTrait; use Flarum\Core\Support\ScopeVisibilityTrait;
use Flarum\Core\Support\ValidateBeforeSaveTrait;
use Flarum\Database\AbstractModel; use Flarum\Database\AbstractModel;
use Flarum\Event\PostWasDeleted; use Flarum\Event\PostWasDeleted;
use Illuminate\Database\Eloquent\Builder; 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. * Determine whether or not this post is visible to the given user.
* *
* @param User $user * @param User $user
* @return boolean * @return bool
*/ */
public function isVisibleTo(User $user) public function isVisibleTo(User $user)
{ {

View File

@ -21,12 +21,12 @@ use Flarum\Core\Post;
class DiscussionRenamedPost extends AbstractEventPost implements MergeableInterface class DiscussionRenamedPost extends AbstractEventPost implements MergeableInterface
{ {
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public static $type = 'discussionRenamed'; public static $type = 'discussionRenamed';
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function saveAfter(Post $previous) public function saveAfter(Post $previous)
{ {

View File

@ -11,8 +11,8 @@
namespace Flarum\Core\Repository; namespace Flarum\Core\Repository;
use Flarum\Core\Discussion; use Flarum\Core\Discussion;
use Illuminate\Database\Eloquent\Builder;
use Flarum\Core\User; use Flarum\Core\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Query\Expression; use Illuminate\Database\Query\Expression;
class DiscussionRepository class DiscussionRepository
@ -31,7 +31,7 @@ class DiscussionRepository
* Find a discussion by ID, optionally making sure it is visible to a * Find a discussion by ID, optionally making sure it is visible to a
* certain user, or throw an exception. * certain user, or throw an exception.
* *
* @param integer $id * @param int $id
* @param User $user * @param User $user
* @return \Flarum\Core\Discussion * @return \Flarum\Core\Discussion
*/ */

View File

@ -10,11 +10,11 @@
namespace Flarum\Core\Repository; namespace Flarum\Core\Repository;
use Flarum\Core\Discussion;
use Flarum\Core\Post; use Flarum\Core\Post;
use Flarum\Core\User;
use Flarum\Event\ScopePostVisibility; use Flarum\Event\ScopePostVisibility;
use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Database\Eloquent\ModelNotFoundException;
use Flarum\Core\User;
use Flarum\Core\Discussion;
class PostRepository class PostRepository
{ {
@ -32,7 +32,7 @@ class PostRepository
* Find a post by ID, optionally making sure it is visible to a certain * Find a post by ID, optionally making sure it is visible to a certain
* user, or throw an exception. * user, or throw an exception.
* *
* @param integer $id * @param int $id
* @param \Flarum\Core\User $actor * @param \Flarum\Core\User $actor
* @return \Flarum\Core\Post * @return \Flarum\Core\Post
* *
@ -56,8 +56,8 @@ class PostRepository
* @param array $where * @param array $where
* @param \Flarum\Core\User|null $actor * @param \Flarum\Core\User|null $actor
* @param array $sort * @param array $sort
* @param integer $count * @param int $count
* @param integer $start * @param int $start
* @return \Illuminate\Database\Eloquent\Collection * @return \Illuminate\Database\Eloquent\Collection
*/ */
public function findWhere(array $where = [], User $actor = null, $sort = [], $count = null, $start = 0) 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 * is. If the post with that number does not exist, the index of the
* closest post to it will be returned. * closest post to it will be returned.
* *
* @param integer $discussionId * @param int $discussionId
* @param integer $number * @param int $number
* @param \Flarum\Core\User|null $actor * @param \Flarum\Core\User|null $actor
* @return integer * @return int
*/ */
public function getIndexForNumber($discussionId, $number, User $actor = null) public function getIndexForNumber($discussionId, $number, User $actor = null)
{ {

View File

@ -71,7 +71,7 @@ class UserRepository
* *
* @param string $username * @param string $username
* @param User|null $actor * @param User|null $actor
* @return integer|null * @return int|null
*/ */
public function getIdForUsername($username, User $actor = null) public function getIdForUsername($username, User $actor = null)
{ {

View File

@ -27,10 +27,10 @@ abstract class AbstractRegexGambit implements GambitInterface
if ($matches = $this->match($bit)) { if ($matches = $this->match($bit)) {
list($negate) = array_splice($matches, 1, 1); list($negate) = array_splice($matches, 1, 1);
$this->conditions($search, $matches, !! $negate); $this->conditions($search, $matches, (bool) $negate);
} }
return !! $matches; return (bool) $matches;
} }
/** /**

View File

@ -11,13 +11,13 @@
namespace Flarum\Core\Search\Discussion; namespace Flarum\Core\Search\Discussion;
use Flarum\Core\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\DiscussionRepository;
use Flarum\Core\Repository\PostRepository; 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\Core\Search\SearchResults;
use Flarum\Event\ConfigureDiscussionSearch;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
/** /**

View File

@ -10,10 +10,10 @@
namespace Flarum\Core\Search\Discussion\Gambit; namespace Flarum\Core\Search\Discussion\Gambit;
use Flarum\Core\Search\Discussion\DiscussionSearch;
use Flarum\Core\Repository\UserRepository; use Flarum\Core\Repository\UserRepository;
use Flarum\Core\Search\AbstractRegexGambit; use Flarum\Core\Search\AbstractRegexGambit;
use Flarum\Core\Search\AbstractSearch; use Flarum\Core\Search\AbstractSearch;
use Flarum\Core\Search\Discussion\DiscussionSearch;
use LogicException; use LogicException;
class AuthorGambit extends AbstractRegexGambit class AuthorGambit extends AbstractRegexGambit

View File

@ -10,9 +10,9 @@
namespace Flarum\Core\Search\Discussion\Gambit; namespace Flarum\Core\Search\Discussion\Gambit;
use Flarum\Core\Search\AbstractSearch;
use Flarum\Core\Search\Discussion\DiscussionSearch; use Flarum\Core\Search\Discussion\DiscussionSearch;
use Flarum\Core\Search\Discussion\Fulltext\DriverInterface; use Flarum\Core\Search\Discussion\Fulltext\DriverInterface;
use Flarum\Core\Search\AbstractSearch;
use Flarum\Core\Search\GambitInterface; use Flarum\Core\Search\GambitInterface;
use LogicException; use LogicException;

View File

@ -10,9 +10,9 @@
namespace Flarum\Core\Search\Discussion\Gambit; namespace Flarum\Core\Search\Discussion\Gambit;
use Flarum\Core\Search\Discussion\DiscussionSearch;
use Flarum\Core\Search\AbstractRegexGambit; use Flarum\Core\Search\AbstractRegexGambit;
use Flarum\Core\Search\AbstractSearch; use Flarum\Core\Search\AbstractSearch;
use Flarum\Core\Search\Discussion\DiscussionSearch;
use LogicException; use LogicException;
class HiddenGambit extends AbstractRegexGambit class HiddenGambit extends AbstractRegexGambit

View File

@ -11,9 +11,9 @@
namespace Flarum\Core\Search\Discussion\Gambit; namespace Flarum\Core\Search\Discussion\Gambit;
use Flarum\Core\Repository\DiscussionRepository; use Flarum\Core\Repository\DiscussionRepository;
use Flarum\Core\Search\Discussion\DiscussionSearch;
use Flarum\Core\Search\AbstractRegexGambit; use Flarum\Core\Search\AbstractRegexGambit;
use Flarum\Core\Search\AbstractSearch; use Flarum\Core\Search\AbstractSearch;
use Flarum\Core\Search\Discussion\DiscussionSearch;
use LogicException; use LogicException;
class UnreadGambit extends AbstractRegexGambit class UnreadGambit extends AbstractRegexGambit

View File

@ -10,10 +10,10 @@
namespace Flarum\Core\Search\User\Gambit; namespace Flarum\Core\Search\User\Gambit;
use Flarum\Core\Search\User\UserSearch;
use Flarum\Core\Repository\UserRepository; use Flarum\Core\Repository\UserRepository;
use Flarum\Core\Search\AbstractRegexGambit; use Flarum\Core\Search\AbstractRegexGambit;
use Flarum\Core\Search\AbstractSearch; use Flarum\Core\Search\AbstractSearch;
use Flarum\Core\Search\User\UserSearch;
use LogicException; use LogicException;
class EmailGambit extends AbstractRegexGambit class EmailGambit extends AbstractRegexGambit

View File

@ -10,11 +10,11 @@
namespace Flarum\Core\Search\User; namespace Flarum\Core\Search\User;
use Flarum\Core\Repository\UserRepository;
use Flarum\Core\Search\ApplySearchParametersTrait; use Flarum\Core\Search\ApplySearchParametersTrait;
use Flarum\Core\Search\GambitManager; use Flarum\Core\Search\GambitManager;
use Flarum\Core\Search\SearchCriteria; use Flarum\Core\Search\SearchCriteria;
use Flarum\Core\Search\SearchResults; use Flarum\Core\Search\SearchResults;
use Flarum\Core\Repository\UserRepository;
use Flarum\Event\ConfigureUserSearch; use Flarum\Event\ConfigureUserSearch;
/** /**

View File

@ -10,9 +10,9 @@
namespace Flarum\Core\Support; namespace Flarum\Core\Support;
use Flarum\Core\User;
use Flarum\Event\ScopeModelVisibility; use Flarum\Event\ScopeModelVisibility;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Flarum\Core\User;
trait ScopeVisibilityTrait trait ScopeVisibilityTrait
{ {

View File

@ -11,9 +11,7 @@
namespace Flarum\Core; namespace Flarum\Core;
use DomainException; use DomainException;
use Flarum\Core;
use Flarum\Core\Access\Gate; use Flarum\Core\Access\Gate;
use Flarum\Core\Notification;
use Flarum\Core\Support\EventGeneratorTrait; use Flarum\Core\Support\EventGeneratorTrait;
use Flarum\Core\Support\ScopeVisibilityTrait; use Flarum\Core\Support\ScopeVisibilityTrait;
use Flarum\Database\AbstractModel; use Flarum\Database\AbstractModel;
@ -79,7 +77,7 @@ class User extends AbstractModel
/** /**
* An array of registered user preferences. Each preference is defined with * 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 * - transformer: a callback that confines the value of the preference
* - default: a default value if the preference isn't set * - 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. * Check if a given password matches the user's password.
* *
* @param string $password * @param string $password
* @return boolean * @return bool
*/ */
public function checkPassword($password) public function checkPassword($password)
{ {
@ -365,7 +363,7 @@ class User extends AbstractModel
* Check whether the user has a certain permission based on their groups. * Check whether the user has a certain permission based on their groups.
* *
* @param string $permission * @param string $permission
* @return boolean * @return bool
*/ */
public function hasPermission($permission) public function hasPermission($permission)
{ {
@ -385,7 +383,7 @@ class User extends AbstractModel
* based on their groups. * based on their groups.
* *
* @param string $match * @param string $match
* @return boolean * @return bool
*/ */
public function hasPermissionLike($match) 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 * @return \Illuminate\Database\Eloquent\Collection
*/ */

View File

@ -28,7 +28,7 @@ abstract class AbstractModel extends Eloquent
/** /**
* Indicates if the model should be timestamped. Turn off by default. * Indicates if the model should be timestamped. Turn off by default.
* *
* @var boolean * @var bool
*/ */
public $timestamps = false; public $timestamps = false;

View File

@ -10,7 +10,6 @@
namespace Flarum\Database; namespace Flarum\Database;
use Flarum\Core;
use Flarum\Foundation\AbstractServiceProvider; use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Foundation\Application; use Flarum\Foundation\Application;
use Illuminate\Database\ConnectionResolver; use Illuminate\Database\ConnectionResolver;

View File

@ -13,7 +13,7 @@ namespace Flarum\Event;
use Flarum\Core\User; use Flarum\Core\User;
/** /**
* The `PrepareUserGroups` event * The `PrepareUserGroups` event.
*/ */
class PrepareUserGroups class PrepareUserGroups
{ {

View File

@ -14,7 +14,7 @@ use Flarum\Core\User;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
/** /**
* The `ScopeHiddenDiscussionVisibility` event * The `ScopeHiddenDiscussionVisibility` event.
*/ */
class ScopeHiddenDiscussionVisibility class ScopeHiddenDiscussionVisibility
{ {

View File

@ -15,7 +15,7 @@ use Flarum\Core\User;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
/** /**
* The `ScopePostVisibility` event * The `ScopePostVisibility` event.
*/ */
class ScopePostVisibility class ScopePostVisibility
{ {

View File

@ -116,7 +116,6 @@ class Extension implements Arrayable
return isset($this->{$name}) || $this->composerJsonAttribute(Str::snake($name, '-')); return isset($this->{$name}) || $this->composerJsonAttribute(Str::snake($name, '-'));
} }
/** /**
* Dot notation getter for composer.json attributes. * Dot notation getter for composer.json attributes.
* *
@ -131,7 +130,7 @@ class Extension implements Arrayable
} }
/** /**
* @param boolean $installed * @param bool $installed
* @return Extension * @return Extension
*/ */
public function setInstalled($installed) public function setInstalled($installed)
@ -142,7 +141,7 @@ class Extension implements Arrayable
} }
/** /**
* @return boolean * @return bool
*/ */
public function isInstalled() public function isInstalled()
{ {
@ -194,7 +193,7 @@ class Extension implements Arrayable
} }
/** /**
* @param boolean $enabled * @param bool $enabled
* @return Extension * @return Extension
*/ */
public function setEnabled($enabled) public function setEnabled($enabled)
@ -205,7 +204,7 @@ class Extension implements Arrayable
} }
/** /**
* @return boolean * @return bool
*/ */
public function isEnabled() public function isEnabled()
{ {

View File

@ -10,7 +10,6 @@
namespace Flarum\Extension; namespace Flarum\Extension;
use Flarum\Core;
use Flarum\Database\Migrator; use Flarum\Database\Migrator;
use Flarum\Event\ExtensionWasDisabled; use Flarum\Event\ExtensionWasDisabled;
use Flarum\Event\ExtensionWasEnabled; use Flarum\Event\ExtensionWasEnabled;
@ -19,7 +18,6 @@ use Flarum\Foundation\Application;
use Flarum\Settings\SettingsRepositoryInterface; use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Filesystem\Filesystem; use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
class ExtensionManager class ExtensionManager

View File

@ -14,7 +14,6 @@ use Flarum\Forum\AuthenticationResponseFactory;
use Flarum\Http\Controller\ControllerInterface; use Flarum\Http\Controller\ControllerInterface;
use League\OAuth2\Client\Provider\ResourceOwnerInterface; use League\OAuth2\Client\Provider\ResourceOwnerInterface;
use Psr\Http\Message\ServerRequestInterface as Request; use Psr\Http\Message\ServerRequestInterface as Request;
use Zend\Diactoros\Response\HtmlResponse;
use Zend\Diactoros\Response\RedirectResponse; use Zend\Diactoros\Response\RedirectResponse;
abstract class AbstractOAuth2Controller implements ControllerInterface abstract class AbstractOAuth2Controller implements ControllerInterface

View File

@ -10,9 +10,8 @@
namespace Flarum\Forum\Controller; namespace Flarum\Forum\Controller;
use Flarum\Core\User;
use Psr\Http\Message\ServerRequestInterface as Request;
use Flarum\Core\Exception\PermissionDeniedException; use Flarum\Core\Exception\PermissionDeniedException;
use Psr\Http\Message\ServerRequestInterface as Request;
class AuthorizedClientController extends ClientController class AuthorizedClientController extends ClientController
{ {

View File

@ -13,9 +13,9 @@ namespace Flarum\Forum\Controller;
use Flarum\Api\Client; use Flarum\Api\Client;
use Flarum\Formatter\Formatter; use Flarum\Formatter\Formatter;
use Flarum\Foundation\Application; use Flarum\Foundation\Application;
use Flarum\Http\Controller\AbstractClientController;
use Flarum\Locale\LocaleManager; use Flarum\Locale\LocaleManager;
use Flarum\Settings\SettingsRepositoryInterface; use Flarum\Settings\SettingsRepositoryInterface;
use Flarum\Http\Controller\AbstractClientController;
use Illuminate\Contracts\Cache\Repository; use Illuminate\Contracts\Cache\Repository;
use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Events\Dispatcher;
@ -55,7 +55,7 @@ class ClientController extends AbstractClientController
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function getAssets() protected function getAssets()
{ {

View File

@ -11,8 +11,8 @@
namespace Flarum\Forum\Controller; namespace Flarum\Forum\Controller;
use Flarum\Core\User; use Flarum\Core\User;
use Psr\Http\Message\ServerRequestInterface as Request;
use Flarum\Http\Exception\RouteNotFoundException; use Flarum\Http\Exception\RouteNotFoundException;
use Psr\Http\Message\ServerRequestInterface as Request;
class DiscussionController extends ClientController class DiscussionController extends ClientController
{ {

View File

@ -12,9 +12,9 @@ namespace Flarum\Forum\Controller;
use Flarum\Api\Client; use Flarum\Api\Client;
use Flarum\Api\Controller\TokenController; use Flarum\Api\Controller\TokenController;
use Flarum\Http\AccessToken;
use Flarum\Event\UserLoggedIn;
use Flarum\Core\Repository\UserRepository; use Flarum\Core\Repository\UserRepository;
use Flarum\Event\UserLoggedIn;
use Flarum\Http\AccessToken;
use Flarum\Http\Controller\ControllerInterface; use Flarum\Http\Controller\ControllerInterface;
use Flarum\Http\Rememberer; use Flarum\Http\Rememberer;
use Flarum\Http\SessionAuthenticator; use Flarum\Http\SessionAuthenticator;

View File

@ -11,7 +11,6 @@
namespace Flarum\Forum\Controller; namespace Flarum\Forum\Controller;
use Flarum\Api\Client; use Flarum\Api\Client;
use Flarum\Http\AccessToken;
use Flarum\Http\Controller\ControllerInterface; use Flarum\Http\Controller\ControllerInterface;
use Flarum\Http\Rememberer; use Flarum\Http\Rememberer;
use Flarum\Http\SessionAuthenticator; use Flarum\Http\SessionAuthenticator;

View File

@ -10,12 +10,12 @@
namespace Flarum\Forum\Controller; namespace Flarum\Forum\Controller;
use DateTime;
use Flarum\Core\Exception\InvalidConfirmationTokenException;
use Flarum\Core\PasswordToken; use Flarum\Core\PasswordToken;
use Flarum\Http\Controller\AbstractHtmlController; use Flarum\Http\Controller\AbstractHtmlController;
use Flarum\Core\Exception\InvalidConfirmationTokenException;
use Psr\Http\Message\ServerRequestInterface as Request;
use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\Factory;
use DateTime; use Psr\Http\Message\ServerRequestInterface as Request;
class ResetPasswordController extends AbstractHtmlController class ResetPasswordController extends AbstractHtmlController
{ {

View File

@ -11,7 +11,6 @@
namespace Flarum\Forum\Controller; namespace Flarum\Forum\Controller;
use Flarum\Core\PasswordToken; use Flarum\Core\PasswordToken;
use Flarum\Core\Command\EditUser;
use Flarum\Forum\UrlGenerator; use Flarum\Forum\UrlGenerator;
use Flarum\Http\Controller\ControllerInterface; use Flarum\Http\Controller\ControllerInterface;
use Flarum\Http\SessionAuthenticator; use Flarum\Http\SessionAuthenticator;

View File

@ -10,7 +10,6 @@
namespace Flarum\Foundation; namespace Flarum\Foundation;
use Flarum\Core;
use Illuminate\Config\Repository as ConfigRepository; use Illuminate\Config\Repository as ConfigRepository;
use Monolog\Formatter\LineFormatter; use Monolog\Formatter\LineFormatter;
use Monolog\Handler\StreamHandler; use Monolog\Handler\StreamHandler;

View File

@ -14,7 +14,6 @@ use Flarum\Api\Client;
use Flarum\Asset\AssetManager; use Flarum\Asset\AssetManager;
use Flarum\Asset\JsCompiler; use Flarum\Asset\JsCompiler;
use Flarum\Asset\LessCompiler; use Flarum\Asset\LessCompiler;
use Flarum\Core;
use Flarum\Event\ConfigureClientView; use Flarum\Event\ConfigureClientView;
use Flarum\Foundation\Application; use Flarum\Foundation\Application;
use Flarum\Locale\JsCompiler as LocaleJsCompiler; use Flarum\Locale\JsCompiler as LocaleJsCompiler;

View File

@ -10,7 +10,6 @@
namespace Flarum\Http\Controller; namespace Flarum\Http\Controller;
use Flarum\Http\Controller\ControllerInterface;
use Psr\Http\Message\ServerRequestInterface as Request; use Psr\Http\Message\ServerRequestInterface as Request;
use Zend\Diactoros\Response; use Zend\Diactoros\Response;

View File

@ -13,9 +13,9 @@ namespace Flarum\Http\Controller;
use Flarum\Api\Client; use Flarum\Api\Client;
use Flarum\Asset\AssetManager; use Flarum\Asset\AssetManager;
use Flarum\Core\User; use Flarum\Core\User;
use Flarum\Locale\JsCompiler;
use Illuminate\Contracts\Support\Renderable; use Illuminate\Contracts\Support\Renderable;
use Psr\Http\Message\ServerRequestInterface as Request; use Psr\Http\Message\ServerRequestInterface as Request;
use Flarum\Locale\JsCompiler;
/** /**
* This class represents a view which boots up Flarum's client. * This class represents a view which boots up Flarum's client.

View File

@ -10,7 +10,6 @@
namespace Flarum\Http\Middleware; namespace Flarum\Http\Middleware;
use DateTime;
use Flarum\Api\ApiKey; use Flarum\Api\ApiKey;
use Flarum\Core\User; use Flarum\Core\User;
use Flarum\Http\AccessToken; use Flarum\Http\AccessToken;

View File

@ -12,7 +12,6 @@
namespace Flarum\Http\Middleware; namespace Flarum\Http\Middleware;
use FastRoute\Dispatcher; use FastRoute\Dispatcher;
use FastRoute\RouteParser;
use Flarum\Http\Exception\MethodNotAllowedException; use Flarum\Http\Exception\MethodNotAllowedException;
use Flarum\Http\Exception\RouteNotFoundException; use Flarum\Http\Exception\RouteNotFoundException;
use Flarum\Http\RouteCollection; use Flarum\Http\RouteCollection;

View File

@ -10,11 +10,11 @@
namespace Flarum\Http\Middleware; namespace Flarum\Http\Middleware;
use Franzl\Middleware\Whoops\ErrorMiddleware as WhoopsMiddleware;
use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request; use Psr\Http\Message\ServerRequestInterface as Request;
use Zend\Diactoros\Response\HtmlResponse; use Zend\Diactoros\Response\HtmlResponse;
use Zend\Stratigility\ErrorMiddlewareInterface; use Zend\Stratigility\ErrorMiddlewareInterface;
use Franzl\Middleware\Whoops\ErrorMiddleware as WhoopsMiddleware;
class HandleErrors implements ErrorMiddlewareInterface class HandleErrors implements ErrorMiddlewareInterface
{ {

View File

@ -10,9 +10,9 @@
namespace Flarum\Install\Console; namespace Flarum\Install\Console;
use Exception;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
use Exception;
class FileDataProvider implements DataProviderInterface class FileDataProvider implements DataProviderInterface
{ {

View File

@ -10,21 +10,17 @@
namespace Flarum\Install\Console; namespace Flarum\Install\Console;
use Exception;
use Flarum\Console\Command\AbstractCommand; use Flarum\Console\Command\AbstractCommand;
use Flarum\Database\AbstractModel;
use Flarum\Core\User;
use Flarum\Core\Group; use Flarum\Core\Group;
use Flarum\Core\Permission; use Flarum\Core\Permission;
use Flarum\Core\User;
use Flarum\Database\AbstractModel;
use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Foundation\Application;
use Illuminate\Filesystem\Filesystem; use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Arr;
use Illuminate\Validation\Factory; use Illuminate\Validation\Factory;
use PDO; use PDO;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
use Exception;
class InstallCommand extends AbstractCommand class InstallCommand extends AbstractCommand
{ {
@ -77,7 +73,7 @@ class InstallCommand extends AbstractCommand
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function fire() protected function fire()
{ {

View File

@ -10,7 +10,6 @@
namespace Flarum\Install\Console; namespace Flarum\Install\Console;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
@ -26,7 +25,6 @@ class UserDataProvider implements DataProviderInterface
protected $baseUrl; protected $baseUrl;
public function __construct(InputInterface $input, OutputInterface $output, QuestionHelper $questionHelper) public function __construct(InputInterface $input, OutputInterface $output, QuestionHelper $questionHelper)
{ {
$this->input = $input; $this->input = $input;

View File

@ -10,10 +10,10 @@
namespace Flarum\Install\Controller; namespace Flarum\Install\Controller;
use Flarum\Install\Prerequisite\PrerequisiteInterface;
use Flarum\Http\Controller\AbstractHtmlController; use Flarum\Http\Controller\AbstractHtmlController;
use Psr\Http\Message\ServerRequestInterface as Request; use Flarum\Install\Prerequisite\PrerequisiteInterface;
use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\Factory;
use Psr\Http\Message\ServerRequestInterface as Request;
class IndexController extends AbstractHtmlController class IndexController extends AbstractHtmlController
{ {

View File

@ -10,19 +10,16 @@
namespace Flarum\Install\Controller; 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 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 class InstallController implements ControllerInterface
{ {

View File

@ -32,9 +32,9 @@ class JsCompiler extends BaseJsCompiler
$output .= file_get_contents($filename); $output .= file_get_contents($filename);
} }
$output .= "} $output .= '}
}; };
});"; });';
return $this->format($output); return $this->format($output);
} }

View File

@ -12,10 +12,6 @@ namespace Flarum\Update\Console;
use Flarum\Console\Command\AbstractCommand; use Flarum\Console\Command\AbstractCommand;
use Illuminate\Contracts\Container\Container; 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 class MigrateCommand extends AbstractCommand
{ {
@ -41,7 +37,7 @@ class MigrateCommand extends AbstractCommand
{ {
$this $this
->setName('migrate') ->setName('migrate')
->setDescription("Run outstanding migrations."); ->setDescription('Run outstanding migrations.');
} }
/** /**

View File

@ -11,8 +11,8 @@
namespace Flarum\Update\Controller; namespace Flarum\Update\Controller;
use Flarum\Http\Controller\AbstractHtmlController; use Flarum\Http\Controller\AbstractHtmlController;
use Psr\Http\Message\ServerRequestInterface as Request;
use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\Factory;
use Psr\Http\Message\ServerRequestInterface as Request;
class IndexController extends AbstractHtmlController class IndexController extends AbstractHtmlController
{ {

View File

@ -1,4 +1,14 @@
<?php <?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; namespace Tests\Flarum\Core\Settings;
use Flarum\Settings\DatabaseSettingsRepository; use Flarum\Settings\DatabaseSettingsRepository;
@ -19,14 +29,14 @@ class DatabaseSettingsRepositoryTest extends TestCase
public function test_requesting_an_existing_setting_should_return_its_value() 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')); $this->assertEquals('value', $this->repository->get('key'));
} }
public function test_non_existent_setting_values_should_return_null() 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')); $this->assertEquals('default', $this->repository->get('key', 'default'));
} }

View File

@ -1,4 +1,14 @@
<?php <?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; namespace Tests\Flarum\Core\Settings;
use Flarum\Settings\MemoryCacheSettingsRepository; use Flarum\Settings\MemoryCacheSettingsRepository;

View File

@ -1,4 +1,14 @@
<?php <?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; namespace Tests\Test;
use Mockery; use Mockery;