Issues (17)

src/ScoutElasticSearchServiceProvider.php (6 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Matchish\ScoutElasticSearch;
6
7
use Elasticsearch\Client;
8
use Illuminate\Support\ServiceProvider;
9
use Laravel\Scout\EngineManager;
10
use Laravel\Scout\ScoutServiceProvider;
11
use Matchish\ScoutElasticSearch\Console\Commands\FlushCommand;
12
use Matchish\ScoutElasticSearch\Console\Commands\ImportCommand;
13
use Matchish\ScoutElasticSearch\Engines\ElasticSearchEngine;
14
use Matchish\ScoutElasticSearch\Searchable\DefaultImportSourceFactory;
15
use Matchish\ScoutElasticSearch\Searchable\ImportSourceFactory;
16
17
final class ScoutElasticSearchServiceProvider extends ServiceProvider
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22 50
    public function boot(): void
23
    {
24 50
        $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'scout');
0 ignored issues
show
The method loadTranslationsFrom() does not exist on Matchish\ScoutElasticSea...icSearchServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        $this->/** @scrutinizer ignore-call */ 
25
               loadTranslationsFrom(__DIR__.'/../resources/lang', 'scout');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25
26
        $this->app->make(EngineManager::class)->extend(ElasticSearchEngine::class, function () {
0 ignored issues
show
The method make() does not exist on Tests\Laravel\App. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

26
        $this->app->/** @scrutinizer ignore-call */ 
27
                    make(EngineManager::class)->extend(ElasticSearchEngine::class, function () {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
27 18
            $elasticsearch = app(Client::class);
28
29 18
            return new ElasticSearchEngine($elasticsearch);
30 50
        });
31 50
        $this->registerCommands();
32 50
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37 50
    public function register(): void
38
    {
39 50
        $this->app->register(ScoutServiceProvider::class);
0 ignored issues
show
The call to Tests\Laravel\App::register() has too many arguments starting with Laravel\Scout\ScoutServiceProvider::class. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

39
        $this->app->/** @scrutinizer ignore-call */ 
40
                    register(ScoutServiceProvider::class);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
40 50
        $this->app->bind(ImportSourceFactory::class, DefaultImportSourceFactory::class);
0 ignored issues
show
The method bind() does not exist on Tests\Laravel\App. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

40
        $this->app->/** @scrutinizer ignore-call */ 
41
                    bind(ImportSourceFactory::class, DefaultImportSourceFactory::class);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
41 50
    }
42
43
    /**
44
     * Register artisan commands.
45
     *
46
     * @return void
47
     */
48 50
    private function registerCommands(): void
49
    {
50 50
        if ($this->app->runningInConsole()) {
0 ignored issues
show
The method runningInConsole() does not exist on Tests\Laravel\App. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

50
        if ($this->app->/** @scrutinizer ignore-call */ runningInConsole()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
51 50
            $this->commands([
0 ignored issues
show
The method commands() does not exist on Matchish\ScoutElasticSea...icSearchServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

51
            $this->/** @scrutinizer ignore-call */ 
52
                   commands([

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
52 50
                ImportCommand::class,
53
                FlushCommand::class,
54
            ]);
55
        }
56 50
    }
57
}
58