Passed
Push — master ( a85346...8e58b4 )
by Songda
02:58 queued 01:06
created

ScanShortcut   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getPlugins() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yansongda\Pay\Shortcut\Wechat;
6
7
use Yansongda\Pay\Contract\ShortcutInterface;
8
use Yansongda\Pay\Plugin\ParserPlugin;
9
use Yansongda\Pay\Plugin\Wechat\LaunchPlugin;
10
use Yansongda\Pay\Plugin\Wechat\Pay\Native\PrepayPlugin;
11
use Yansongda\Pay\Plugin\Wechat\PreparePlugin;
12
use Yansongda\Pay\Plugin\Wechat\RadarSignPlugin;
13
14
class ScanShortcut implements ShortcutInterface
15
{
16
    public function getPlugins(array $params): array
17
    {
18
        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...
19
            PreparePlugin::class,
20
            PrepayPlugin::class,
21
            RadarSignPlugin::class,
22
            LaunchPlugin::class,
23
            ParserPlugin::class,
24
        ];
25
    }
26
}
27