Passed
Pull Request — master (#6)
by Angel
09:45
created

WebController::actions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace app\controllers;
4
5
use app\models\User;
6
use roaresearch\yii2\oauth2server\actions\AuthorizeAction;
0 ignored issues
show
Bug introduced by
The type roaresearch\yii2\oauth2s...actions\AuthorizeAction was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Yii;
8
9
class WebController extends \yii\web\Controller
10
{
11
    public function actions()
12
    {
13
        return [
14
            'authorize' => [
15
                'class' => AuthorizeAction::class,
16
                'loginUri' => ['login'],
17
            ],
18
        ];
19
    }
20
21
    public function actionLogin()
22
    {
23
        Yii::$app->user->login(User::findOne(1));
0 ignored issues
show
Bug introduced by
app\models\User::findOne(1) of type yii\db\ActiveRecord is incompatible with the type yii\web\IdentityInterface expected by parameter $identity of yii\web\User::login(). ( Ignorable by Annotation )

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

23
        Yii::$app->user->login(/** @scrutinizer ignore-type */ User::findOne(1));
Loading history...
Bug introduced by
The method login() does not exist on null. ( Ignorable by Annotation )

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

23
        Yii::$app->user->/** @scrutinizer ignore-call */ 
24
                         login(User::findOne(1));

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...
24
25
        return $this->goBack();
26
    }
27
}
28