Passed
Push — master ( e4a200...c44a4f )
by Songda
03:06 queued 01:11
created

WebShortcut   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 9
dl 0
loc 12
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getPlugins() 0 10 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yansongda\Pay\Shortcut\Alipay;
6
7
use Yansongda\Pay\Contract\ShortcutInterface;
8
use Yansongda\Pay\Plugin\Alipay\AddRadarPlugin;
9
use Yansongda\Pay\Plugin\Alipay\AddSignaturePlugin;
10
use Yansongda\Pay\Plugin\Alipay\FormatBizContentPlugin;
11
use Yansongda\Pay\Plugin\Alipay\Pay\Web\PayPlugin;
12
use Yansongda\Pay\Plugin\Alipay\ResponseHtmlPlugin;
13
use Yansongda\Pay\Plugin\Alipay\StartPlugin;
14
use Yansongda\Pay\Plugin\ParserPlugin;
15
16
class WebShortcut 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\P...in\ParserPlugin::class) returns the type array<integer,string> which is incompatible with the return type mandated by Yansongda\Pay\Contract\S...Interface::getPlugins() of Yansongda\Pay\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
            FormatBizContentPlugin::class,
24
            AddSignaturePlugin::class,
25
            AddRadarPlugin::class,
26
            ResponseHtmlPlugin::class,
27
            ParserPlugin::class,
28
        ];
29
    }
30
}
31