/
TypeComparisonResult.php
44 lines (33 loc) · 1.09 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
<?php
namespace Psalm\Internal\Type\Comparator;
use Psalm\Type\Atomic;
use Psalm\Type\Union;
/**
* @internal
*/
class TypeComparisonResult
{
/**
* This is used to trigger `InvalidScalarArgument` in situations where we know PHP
* will try to coerce one scalar type to another.
*/
public ?bool $scalar_type_match_found = null;
public ?bool $type_coerced = null;
public ?bool $type_coerced_from_mixed = null;
public ?bool $type_coerced_from_as_mixed = null;
public ?bool $to_string_cast = null;
/**
* 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];
* }
*/
public ?bool $type_coerced_from_scalar = null;
public ?Union $replacement_union_type = null;
public ?Atomic $replacement_atomic_type = null;
/** @var ?non-empty-list<int|string> */
public ?array $missing_shape_fields = null;
}