/
TypeComparisonResult.php
48 lines (38 loc) · 1.06 KB
/
TypeComparisonResult.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
namespace Psalm\Internal\Type\Comparator;
use Psalm\Type\Atomic;
use Psalm\Type\Union;
class TypeComparisonResult
{
/**
* This is used to trigger `InvalidScalarArgument` in situations where we know PHP
* will try to coerce one scalar type to another.
*
* @var ?bool
*/
public $scalar_type_match_found;
/** @var ?bool */
public $type_coerced;
/** @var ?bool */
public $type_coerced_from_mixed;
/** @var ?bool */
public $type_coerced_from_as_mixed;
/** @var ?bool */
public $to_string_cast;
/**
* This is primarily used for array access.
* For example in this function we know that there are only two possible keys, 0 and 1
* But we allow the array to be addressed by an arbitrary integer $i.
*
* function takesAnInt(int $i): string {
* return ["foo", "bar"][$i];
* }
*
* @var ?bool
*/
public $type_coerced_from_scalar;
/** @var ?Union */
public $replacement_union_type;
/** @var ?Atomic */
public $replacement_atomic_type;
}