Passed
Push — renovate/php-8.x ( bfb893...222c0a )
by
unknown
02:20
created

ZvalU1   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 14
c 1
b 0
f 1
dl 0
loc 28
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __get() 0 7 1
A __construct() 0 7 1
1
<?php
2
3
/**
4
 * This file is part of the sj-i/php-profiler package.
5
 *
6
 * (c) sji <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace PhpProfiler\Lib\PhpInternals\Types\Zend;
15
16
use FFI\CData;
17
use FFI\PhpInternals\zval_u1;
18
19
class ZvalU1
20
{
21
    /** @psalm-suppress PropertyNotSetInConstructor */
22
    public int $type_info;
23
    /** @psalm-suppress PropertyNotSetInConstructor */
24
    public int $type;
25
    /** @psalm-suppress PropertyNotSetInConstructor */
26
    public int $type_flags;
27
    /** @psalm-suppress PropertyNotSetInConstructor */
28
    public int $extra;
29
30
    /** @param zval_u1 $cdata */
31
    public function __construct(
32
        private CData $cdata
33
    ) {
34
        unset($this->type_info);
35
        unset($this->type);
36
        unset($this->type_flags);
37
        unset($this->extra);
38
    }
39
40
    public function __get(string $field_name): mixed
41
    {
42
        return match ($field_name) {
43
            'type_info' => $this->cdata->type_info,
44
            'type' => $this->cdata->v->type,
45
            'type_flags' => $this->cdata->v->type_flags,
46
            'extra' => $this->cdata->v->u->extra,
47
        };
48
    }
49
}
50