Passed
Push — master ( e73c8b...2ea20b )
by Songda
04:10 queued 02:00
created

MiniShortcut::getPlugins()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
nc 1
nop 1
dl 0
loc 10
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yansongda\Pay\Shortcut\Douyin;
6
7
use Yansongda\Artful\Contract\ShortcutInterface;
8
use Yansongda\Artful\Plugin\AddPayloadBodyPlugin;
9
use Yansongda\Artful\Plugin\ParserPlugin;
10
use Yansongda\Artful\Plugin\StartPlugin;
11
use Yansongda\Pay\Plugin\Douyin\V1\Pay\AddPayloadSignaturePlugin;
12
use Yansongda\Pay\Plugin\Douyin\V1\Pay\AddRadarPlugin;
13
use Yansongda\Pay\Plugin\Douyin\V1\Pay\Mini\PayPlugin;
14
use Yansongda\Pay\Plugin\Douyin\V1\Pay\ResponsePlugin;
15
16
class MiniShortcut implements ShortcutInterface
17
{
18
    public function getPlugins(array $params): array
19
    {
20
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array(Yansongda\A...in\ParserPlugin::class) returns the type array<integer,string> which is incompatible with the return type mandated by Yansongda\Artful\Contrac...Interface::getPlugins() of Yansongda\Artful\Contract\PluginInterface[].

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
21
            StartPlugin::class,
22
            PayPlugin::class,
23
            AddPayloadSignaturePlugin::class,
24
            AddPayloadBodyPlugin::class,
25
            AddRadarPlugin::class,
26
            ResponsePlugin::class,
27
            ParserPlugin::class,
28
        ];
29
    }
30
}
31