Passed
Pull Request — master (#662)
by Songda
01:53
created

CancelShortcut   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 6
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getPlugins() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yansongda\Pay\Plugin\Unipay\Shortcut;
6
7
use Yansongda\Pay\Contract\ShortcutInterface;
8
use Yansongda\Pay\Plugin\Unipay\OnlineGateway\CancelPlugin;
9
10
class CancelShortcut implements ShortcutInterface
11
{
12
    public function getPlugins(array $params): array
13
    {
14
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array(Yansongda\P...ay\CancelPlugin::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...
15
            CancelPlugin::class,
16
        ];
17
    }
18
}
19