mirror of
https://github.com/flarum/framework.git
synced 2025-02-24 04:16:40 +08:00
More indentation cleanup
This commit is contained in:
parent
b461f157ca
commit
730a46d885
@ -86,8 +86,9 @@ class ListPostsController extends AbstractCollectionController
|
||||
|
||||
if (($near = array_get($queryParams, 'page.near')) > 1) {
|
||||
if (count($filter) > 1 || ! isset($filter['discussion']) || $sort) {
|
||||
throw new InvalidParameterException('You can only use page[near] with '
|
||||
.'filter[discussion] and the default sort order');
|
||||
throw new InvalidParameterException(
|
||||
'You can only use page[near] with filter[discussion] and the default sort order'
|
||||
);
|
||||
}
|
||||
|
||||
$offset = $this->posts->getIndexForNumber($filter['discussion'], $near, $actor);
|
||||
|
@ -121,8 +121,9 @@ abstract class AbstractSerializer extends BaseAbstractSerializer
|
||||
);
|
||||
|
||||
if ($relationship && ! ($relationship instanceof Relationship)) {
|
||||
throw new LogicException('GetApiRelationship handler must return an instance of '
|
||||
.Relationship::class);
|
||||
throw new LogicException(
|
||||
'GetApiRelationship handler must return an instance of '.Relationship::class
|
||||
);
|
||||
}
|
||||
|
||||
return $relationship;
|
||||
|
@ -29,8 +29,9 @@ class DiscussionBasicSerializer extends AbstractSerializer
|
||||
protected function getDefaultAttributes($discussion)
|
||||
{
|
||||
if (! ($discussion instanceof Discussion)) {
|
||||
throw new InvalidArgumentException(get_class($this)
|
||||
.' can only serialize instances of '.Discussion::class);
|
||||
throw new InvalidArgumentException(
|
||||
get_class($this).' can only serialize instances of '.Discussion::class
|
||||
);
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -43,8 +43,9 @@ class GroupSerializer extends AbstractSerializer
|
||||
protected function getDefaultAttributes($group)
|
||||
{
|
||||
if (! ($group instanceof Group)) {
|
||||
throw new InvalidArgumentException(get_class($this)
|
||||
.' can only serialize instances of '.Group::class);
|
||||
throw new InvalidArgumentException(
|
||||
get_class($this).' can only serialize instances of '.Group::class
|
||||
);
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -37,8 +37,9 @@ class NotificationSerializer extends AbstractSerializer
|
||||
protected function getDefaultAttributes($notification)
|
||||
{
|
||||
if (! ($notification instanceof Notification)) {
|
||||
throw new InvalidArgumentException(get_class($this)
|
||||
.' can only serialize instances of '.Notification::class);
|
||||
throw new InvalidArgumentException(
|
||||
get_class($this).' can only serialize instances of '.Notification::class
|
||||
);
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -30,8 +30,9 @@ class PostBasicSerializer extends AbstractSerializer
|
||||
protected function getDefaultAttributes($post)
|
||||
{
|
||||
if (! ($post instanceof Post)) {
|
||||
throw new InvalidArgumentException(get_class($this)
|
||||
.' can only serialize instances of '.Post::class);
|
||||
throw new InvalidArgumentException(
|
||||
get_class($this).' can only serialize instances of '.Post::class
|
||||
);
|
||||
}
|
||||
|
||||
$attributes = [
|
||||
|
@ -29,8 +29,9 @@ class UserBasicSerializer extends AbstractSerializer
|
||||
protected function getDefaultAttributes($user)
|
||||
{
|
||||
if (! ($user instanceof User)) {
|
||||
throw new InvalidArgumentException(get_class($this)
|
||||
.' can only serialize instances of '.User::class);
|
||||
throw new InvalidArgumentException(
|
||||
get_class($this).' can only serialize instances of '.User::class
|
||||
);
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -105,8 +105,9 @@ class GambitManager
|
||||
foreach ($bits as $k => $bit) {
|
||||
foreach ($gambits as $gambit) {
|
||||
if (! $gambit instanceof GambitInterface) {
|
||||
throw new LogicException('GambitInterface '.get_class($gambit)
|
||||
.' does not implement '.GambitInterface::class);
|
||||
throw new LogicException(
|
||||
'Gambit '.get_class($gambit).' does not implement '.GambitInterface::class
|
||||
);
|
||||
}
|
||||
|
||||
if ($gambit->apply($search, $bit)) {
|
||||
|
@ -106,8 +106,9 @@ abstract class AbstractModel extends Eloquent
|
||||
// value on the "relationships" array.
|
||||
if (! $this->relationLoaded($key) && ($relation = $this->getCustomRelation($key))) {
|
||||
if (! $relation instanceof Relation) {
|
||||
throw new LogicException('Relationship method must return an object of type '
|
||||
.'Illuminate\Database\Eloquent\Relations\Relation');
|
||||
throw new LogicException(
|
||||
'Relationship method must return an object of type '.Relation::class
|
||||
);
|
||||
}
|
||||
|
||||
return $this->relations[$key] = $relation->getResults();
|
||||
|
@ -44,8 +44,9 @@ class ConfigureNotificationTypes
|
||||
public function add($blueprint, $serializer, $enabledByDefault = [])
|
||||
{
|
||||
if (! (new ReflectionClass($blueprint))->implementsInterface(BlueprintInterface::class)) {
|
||||
throw new InvalidArgumentException('Notification blueprint '.$blueprint
|
||||
.' must implement '.BlueprintInterface::class);
|
||||
throw new InvalidArgumentException(
|
||||
'Notification blueprint '.$blueprint.' must implement '.BlueprintInterface::class
|
||||
);
|
||||
}
|
||||
|
||||
$this->blueprints[$blueprint] = $enabledByDefault;
|
||||
|
@ -12,6 +12,7 @@ namespace Flarum\Http;
|
||||
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use InvalidArgumentException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
trait GenerateRouteHandlerTrait
|
||||
@ -26,8 +27,9 @@ trait GenerateRouteHandlerTrait
|
||||
$controller = $container->make($class);
|
||||
|
||||
if (! ($controller instanceof ControllerInterface)) {
|
||||
throw new \InvalidArgumentException('Route handler must be an instance of '
|
||||
.ControllerInterface::class);
|
||||
throw new InvalidArgumentException(
|
||||
'Route handler must be an instance of '.ControllerInterface::class
|
||||
);
|
||||
}
|
||||
|
||||
$request = $request->withQueryParams(array_merge($request->getQueryParams(), $routeParams));
|
||||
|
Loading…
x
Reference in New Issue
Block a user