Passed
Push — feature/51 ( 15fa2a...ffcada )
by Max
02:36
created

Let::value()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace MaxGoryunov\SavingIterator\Fakes;
4
5
use Closure;
6
use MaxGoryunov\SavingIterator\Src\Scalar;
7
8
/**
9
 * Allows to use context instead of creating a new variable.
10
 * @template X subject type.
11
 * @template Y context result type.
12
 * @implements Scalar<Y>
13
 * 
14
 * @todo #44:25min Classes Let and The contain some repeated cdde which could
15
 *  be extracted into a separate class.
16
 */
17
class Let implements Scalar
18
{
19
20
    /**
21
     * Ctor.
22
     * 
23
     * @param X             $subject
0 ignored issues
show
Bug introduced by
The type MaxGoryunov\SavingIterator\Fakes\X was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
24
     * @param Closure(X): Y $context
25
     */
26
    public function __construct(
27
        /**
28
         * Element to be put into the context.
29
         * 
30
         * @var X
31
         */
32
        private mixed $subject,
33
34
        /**
35
         * Context for the element.
36
         * 
37
         * @var Closure(X): Y
38
         */
39
        private Closure $context
40
    ) {
41
    }
42
43
    /**
44
     * Returns result of applying context to element.
45
     *
46
     * @return Y
0 ignored issues
show
Bug introduced by
The type MaxGoryunov\SavingIterator\Fakes\Y was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
47
     */
48
    public function value(): mixed
49
    {
50
        return ($this->context)($this->subject);
51
    }
52
}
53