Let::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 3
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace MaxGoryunov\SavingIterator\Fakes;
4
5
use Closure;
6
7
/**
8
 * Allows to use context instead of creating a new variable.
9
 * @template X subject type
10
 * @template Y result type
11
 * @extends SurveyEnvelope<X, Y>
12
 */
13
class Let extends SurveyEnvelope
14
{
15
16
    /**
17
     * Ctor.
18
     *
19
     * @phpstan-param X $subject
20
     * @param mixed $subject element for context.
21
     */
22
    public function __construct(mixed $subject) {
23
        parent::__construct(
24
            $subject,
25
            fn ($subject, Closure $context): mixed => $context($subject) 
26
        );
27
    }
28
}
29