Completed
Push — master ( b5c2a9...ab10ed )
by Atymic
06:11
created

src/ServiceProvider.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace SocialiteProviders\Manager;
4
5
use Laravel\Socialite\SocialiteServiceProvider;
6
use SocialiteProviders\Manager\Contracts\Helpers\ConfigRetrieverInterface;
7
use SocialiteProviders\Manager\Helpers\ConfigRetriever;
8
9
class ServiceProvider extends SocialiteServiceProvider
10
{
11
    /**
12
     * Bootstrap the provider services.
13
     */
14 1
    public function boot()
15
    {
16 1
        if ($this->app instanceof \Illuminate\Foundation\Application) {
0 ignored issues
show
The class Illuminate\Foundation\Application does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
17 1
            // Laravel
18
            $this->app->booted(function () {
19
                $socialiteWasCalled = app(SocialiteWasCalled::class);
20
21
                event($socialiteWasCalled);
22
            });
23
        } else {
24
            // Lumen
25
            $socialiteWasCalled = app(SocialiteWasCalled::class);
26
27
            event($socialiteWasCalled);
28
        }
29
    }
30
31
    /**
32
     * Register the provider services.
33
     */
34
    public function register()
35
    {
36
        parent::register();
37
38
        if (class_exists('Laravel\Lumen\Application') && !defined('SOCIALITEPROVIDERS_STATELESS')) {
39
            define('SOCIALITEPROVIDERS_STATELESS', true);
40
        }
41
42
        if (!$this->app->bound(ConfigRetrieverInterface::class)) {
43
            $this->app->singleton(ConfigRetrieverInterface::class, function () {
44
                return new ConfigRetriever();
45
            });
46
        }
47
    }
48
}
49