This repository has been archived by the owner on Apr 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
TypeInterface.php
128 lines (107 loc) · 3.03 KB
/
TypeInterface.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php
/**
* This file is part of PhpUnitGen.
*
* (c) 2017-2018 Paul Thébaud <paul.thebaud29@gmail.com>
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/
namespace PhpUnitGen\Model\PropertyInterface;
/**
* Interface TypeInterface.
*
* @author Paul Thébaud <paul.thebaud29@gmail.com>.
* @copyright 2017-2018 Paul Thébaud <paul.thebaud29@gmail.com>.
* @license https://opensource.org/licenses/MIT The MIT license.
* @link https://github.com/paul-thebaud/phpunit-generator
* @since Class available since Release 2.0.0.
*/
interface TypeInterface extends NodeInterface
{
/**
* @var string UNKNOWN_CUSTOM A string describing an unknown custom type.
*/
public const UNKNOWN_CUSTOM = 'UNKNOWN_CUSTOM_TYPE';
/**
* @var null MIXED A mixed value (can be whatever).
*/
public const MIXED = null;
/**
* @var int CUSTOM A custom type hint (class, interface ...).
*/
public const CUSTOM = 0;
/**
* @var int OBJECT An object value (type hint "object").
*/
public const OBJECT = 1;
/**
* @var int BOOL A bool value (true or false).
*/
public const BOOL = 2;
/**
* @var int INT A int value (a PHP integer: ... -1, 0, 1 ...).
*/
public const INT = 3;
/**
* @var int FLOAT A float value (a PHP float: ... -0.1, 1.0, 1.01 ...).
*/
public const FLOAT = 4;
/**
* @var int ARRAY A array value (a PHP array: [1, 2, 3]).
*/
public const ARRAY = 5;
/**
* @var int ITERABLE A iterable value (a PHP iterable: array or Traversable).
*/
public const ITERABLE = 6;
/**
* @var int CALLABLE A callable value (a PHP callable: function () {}).
*/
public const CALLABLE = 7;
/**
* @var int STRING A string value (a PHP string: 'something' or "something").
*/
public const STRING = 8;
/**
* @var string[] RESERVED_TYPE_IDENTIFIERS The reserved words for types.
*/
public const RESERVED_TYPE_IDENTIFIERS = [
'object',
'bool',
'int',
'float',
'array',
'iterable',
'callable',
'string',
];
/**
* @var int VOID A void value (used for void return type).
*/
public const VOID = 9;
/**
* @param int|null $type The new type to set.
*/
public function setType(?int $type): void;
/**
* @return int|null The current type.
*/
public function getType(): ?int;
/**
* @param bool $nullable The new nullable value to set.
*/
public function setNullable(bool $nullable): void;
/**
* @return bool True if it is nullable.
*/
public function nullable(): bool;
/**
* @param string|null $customType The new custom type to set as a string.
*/
public function setCustomType(?string $customType): void;
/**
* @return string|null The current custom type as a string.
*/
public function getCustomType(): ?string;
}