This repository has been archived by the owner on Nov 21, 2017. It is now read-only.
/
TyphaxASTGeneratorTypeCheck.php
211 lines (189 loc) · 8.8 KB
/
TyphaxASTGeneratorTypeCheck.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<?php
namespace Eloquent\Typhoon\TypeCheck\Validator\Eloquent\Typhoon\Generator;
class TyphaxASTGeneratorTypeCheck extends \Eloquent\Typhoon\TypeCheck\AbstractValidator
{
public function validateConstruct(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount > 2) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(2, $arguments[2]);
}
}
public function visitAndType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\AndType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitArrayType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\ArrayType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitBooleanType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\BooleanType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitCallableType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\CallableType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitExtensionType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\ExtensionType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitFloatType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\FloatType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitIntegerType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\IntegerType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitMixedType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\MixedType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitNullType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\NullType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitNullifiedType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhoon\\Generator\\NullifiedType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitNumericType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\NumericType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitObjectType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\ObjectType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitOrType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\OrType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitResourceType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\ResourceType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitStreamType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\StreamType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitStringType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\StringType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitStringableType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\StringableType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitTraversableType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\TraversableType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function visitTupleType(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\MissingArgumentException('type', 0, 'Eloquent\\Typhax\\Type\\TupleType');
} elseif ($argumentCount > 1) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}
public function valueExpression(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Eloquent\Typhoon\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}
}