MethodConfig   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 2
c 2
b 1
f 0
dl 0
loc 34
ccs 4
cts 4
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 20 1
A hasReturnType() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Proxy\Config;
6
7
/**
8
 * @internal
9
 *
10
 * A method metadata. {@see ClassConfigFactory} is used for creation. Note that it relies only on PHP type hints and
11
 * ignores PHPDoc completely.
12
 */
13
final class MethodConfig
14
{
15 12
    public function __construct(
16
        /**
17
         * @var string[] A list of modifiers, for example: `['abstract', 'public']`.
18
         */
19
        public array $modifiers,
20
        /**
21
         * @var string A name without parentheses. For example: `getInstance`.
22
         */
23
        public string $name,
24
        /**
25
         * @var ParameterConfig[] A map where key is a {@see ParameterConfig::$name} and value is {@see ParameterConfig}
26
         * instance.
27
         * @psalm-var array<string, ParameterConfig>
28
         */
29
        public array $parameters,
30
        /**
31
         * @var TypeConfig|null Return type config. `null` means no return type specified.
32
         */
33
        public ?TypeConfig $returnType,
34
    ) {
35 12
    }
36
37
    /**
38
     * Whether a method has return type.
39
     *
40
     * @return bool `true` if return type specified and `false` otherwise.
41
     *
42
     * @psalm-assert-if-true TypeConfig $this->returnType
43
     */
44 9
    public function hasReturnType(): bool
45
    {
46 9
        return $this->returnType !== null;
47
    }
48
}
49