Passed
Pull Request — master (#763)
by
unknown
02:15
created

PapayShortcut   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 10
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getPlugins() 0 8 1
1
<?php
2
3
namespace Yansongda\Pay\Plugin\Wechat\Shortcut;
4
5
use Yansongda\Pay\Contract\ShortcutInterface;
6
use Yansongda\Pay\Plugin\ParserPlugin;
7
use Yansongda\Pay\Plugin\Wechat\Papay\PayContractOrderPlugin;
8
use Yansongda\Pay\Plugin\Wechat\Pay\Common\InvokePrepayV2Plugin;
9
use Yansongda\Pay\Plugin\Wechat\PreparePlugin;
10
use Yansongda\Pay\Plugin\Wechat\RadarSignPlugin;
11
12
/**
13
 * 支付中签约.
14
 */
15
class PapayShortcut implements ShortcutInterface
16
{
17
    public function getPlugins(array $params): array
18
    {
19
        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...
20
            PreparePlugin::class,
21
            PayContractOrderPlugin::class,
22
            RadarSignPlugin::class,
23
            InvokePrepayV2Plugin::class,
24
            ParserPlugin::class,
25
        ];
26
    }
27
}
28