Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Oct 12, 2023
1 parent b05d6d8 commit 05324a0
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 19 deletions.
1 change: 0 additions & 1 deletion extensions/tags/src/Api/Controller/ListTagsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Flarum\Search\SearchCriteria;
use Flarum\Search\SearchManager;
use Flarum\Tags\Api\Serializer\TagSerializer;
use Flarum\Tags\Search\TagSearcher;
use Flarum\Tags\Tag;
use Flarum\Tags\TagRepository;
use Psr\Http\Message\ServerRequestInterface;
Expand Down
2 changes: 1 addition & 1 deletion framework/core/src/Api/ApiServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function register(): void
$this->container->singleton('flarum.api.middleware', function () {
return [
HttpMiddleware\InjectActorReference::class,
// 'flarum.api.error_handler',
// 'flarum.api.error_handler',
HttpMiddleware\ParseJsonBody::class,
Middleware\FakeHttpMethods::class,
HttpMiddleware\StartSession::class,
Expand Down
2 changes: 1 addition & 1 deletion framework/core/src/Extend/SearchDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
use Flarum\Search\AbstractDriver;
use Flarum\Search\AbstractFulltextFilter;
use Flarum\Search\Database\AbstractSearcher;
use Flarum\Search\SearchState;
use Flarum\Search\Filter\FilterInterface;
use Flarum\Search\SearchCriteria;
use Flarum\Search\SearchState;
use Illuminate\Contracts\Container\Container;

class SearchDriver implements ExtenderInterface
Expand Down
8 changes: 7 additions & 1 deletion framework/core/src/Extend/SearchIndex.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Extend;

use Flarum\Extend\ExtenderInterface;
use Flarum\Extension\Extension;
use Illuminate\Contracts\Container\Container;

Expand Down
7 changes: 7 additions & 0 deletions framework/core/src/Search/AbstractDriver.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Search;

use Flarum\Database\AbstractModel;
Expand Down
2 changes: 0 additions & 2 deletions framework/core/src/Search/Database/AbstractSearcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
namespace Flarum\Search\Database;

use Flarum\Search\Filter\FilterManager;
use Flarum\Search\IndexerInterface;
use Flarum\Search\SearchCriteria;
use Flarum\Search\SearcherInterface;
use Flarum\Search\SearchResults;
use Flarum\User\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Str;

abstract class AbstractSearcher implements SearcherInterface
Expand Down
7 changes: 7 additions & 0 deletions framework/core/src/Search/Database/DatabaseSearchDriver.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Search\Database;

use Flarum\Search\AbstractDriver;
Expand Down
17 changes: 12 additions & 5 deletions framework/core/src/Search/IndexerInterface.php
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Search;

use Flarum\Database\AbstractModel;

interface IndexerInterface
{
static function index(): string;
public static function index(): string;

/**
* @param AbstractModel[] $models
*/
function save(array $models): void;
public function save(array $models): void;

/**
* @param AbstractModel[] $models
*/
function delete(array $models): void;
public function delete(array $models): void;

/**
* Build the index from scratch.
*/
function build(): void;
public function build(): void;

/**
* Flush the index.
*/
function flush(): void;
public function flush(): void;
}
7 changes: 7 additions & 0 deletions framework/core/src/Search/Job/IndexJob.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Search\Job;

use Flarum\Database\AbstractModel;
Expand Down
7 changes: 7 additions & 0 deletions framework/core/src/Search/Listener/ModelObserver.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Search\Listener;

use Flarum\Database\AbstractModel;
Expand Down
7 changes: 7 additions & 0 deletions framework/core/src/Search/SearchManager.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Search;

use Flarum\Database\AbstractModel;
Expand Down
2 changes: 1 addition & 1 deletion framework/core/src/Search/SearchServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
use Flarum\Group\Filter\GroupSearcher;
use Flarum\Group\Group;
use Flarum\Http\AccessToken;
use Flarum\Http\Filter as HttpFilter;
use Flarum\Http\Filter\AccessTokenSearcher;
use Flarum\Http\Filter as HttpFilter;
use Flarum\Post\Filter as PostFilter;
use Flarum\Post\Filter\PostSearcher;
use Flarum\Post\Post;
Expand Down
9 changes: 8 additions & 1 deletion framework/core/src/Search/SearchState.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Search;

use Closure;
Expand All @@ -13,7 +20,7 @@ class SearchState
*/
protected array $activeFilters = [];

public final function __construct(
final public function __construct(
protected User $actor,
/**
* Whether this is a fulltext search or just filtering.
Expand Down
11 changes: 9 additions & 2 deletions framework/core/src/Search/SearcherInterface.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Search;

use Flarum\User\User;
use Illuminate\Database\Eloquent\Builder;

interface SearcherInterface
{
function getQuery(User $actor): Builder;
public function getQuery(User $actor): Builder;

function search(SearchCriteria $criteria): SearchResults;
public function search(SearchCriteria $criteria): SearchResults;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
use Flarum\Discussion\Discussion;
use Flarum\Discussion\Search\DiscussionSearcher;
use Flarum\Extend;
use Flarum\Group\Group;
use Flarum\Search\AbstractFulltextFilter;
use Flarum\Search\Database\AbstractSearcher;
use Flarum\Search\Database\DatabaseSearchDriver;
use Flarum\Search\Database\DatabaseSearchState;
use Flarum\Search\Filter\FilterInterface;
Expand All @@ -25,8 +23,6 @@
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
use Flarum\Testing\integration\TestCase;
use Flarum\User\User;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Database\Eloquent\Builder;

class SimpleFlarumSearchTest extends TestCase
{
Expand Down

0 comments on commit 05324a0

Please sign in to comment.