int()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
/**
4
 * This file is part of the sj-i/typist 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 Typist;
15
16
/**
17
 * @param-out bool $value_holder
18
 */
19
function bool(?bool &$value_holder, bool $value): BoolEnforcer
20
{
21
    return Typist::bool($value_holder, $value);
22
}
23
24
/**
25
 * @param-out int $value_holder
26
 */
27
function int(?int &$value_holder, int $value): IntEnforcer
28
{
29
    return Typist::int($value_holder, $value);
30
}
31
32
/**
33
 * @param-out float $value_holder
34
 */
35
function float(?float &$value_holder, float $value): FloatEnforcer
36
{
37
    return Typist::float($value_holder, $value);
38
}
39
40
/**
41
 * @param-out string $value_holder
42
 */
43
function string(?string &$value_holder, string $value): StringEnforcer
44
{
45
    return Typist::string($value_holder, $value);
46
}
47
48
/**
49
 * @template T
50
 * @param class-string<T> $class_name
51
 * @param T|null $value_holder
52
 * @param T $value
53
 * @param-out T $value_holder
54
 * @return ClassEnforcer
55
 * @throws \ReflectionException
56
 */
57
function class_(string $class_name, &$value_holder, $value): ClassEnforcer
58
{
59
    return Typist::class($class_name, $value_holder, $value);
60
}
61
62
/**
63
 * @param-out bool|null $value_holder
64
 */
65
function nullable_bool(?bool &$value_holder, ?bool $value): NullableBoolEnforcer
66
{
67
    return Typist::nullable()::bool($value_holder, $value);
68
}
69
70
/**
71
 * @param-out int|null $value_holder
72
 */
73
function nullable_int(?int &$value_holder, ?int $value): NullableIntEnforcer
74
{
75
    return Typist::nullable()::int($value_holder, $value);
76
}
77
78
/**
79
 * @param-out float|null $value_holder
80
 */
81
function nullable_float(?float &$value_holder, ?float $value): NullableFloatEnforcer
82
{
83
    return Typist::nullable()::float($value_holder, $value);
84
}
85
86
/**
87
 * @param-out string|null $value_holder
88
 */
89
function nullable_string(?string &$value_holder, ?string $value): NullableStringEnforcer
90
{
91
    return Typist::nullable()::string($value_holder, $value);
92
}
93
94
/**
95
 * @template T
96
 * @param class-string<T> $class_name
97
 * @param T|null $value_holder
98
 * @param T|null $value
99
 * @param-out T|null $value_holder
100
 * @return NullableClassEnforcer
101
 */
102
function nullable_class(string $class_name, &$value_holder, $value): NullableClassEnforcer
103
{
104
    return Typist::nullable()::class($class_name, $value_holder, $value);
105
}
106