@@ -51,29 +51,27 @@ public static function toStringDataProvider(): iterable
51
51
yield ['? ' .DummyBackedEnum::class, new Type ('enum ' , isNullable: true , className: DummyBackedEnum::class)];
52
52
53
53
// generic types
54
- yield [ClassicDummy::class.'<int> ' , new Type ('object ' , className: ClassicDummy::class, isGeneric: true , genericParameterTypes: [new Type ('int ' )])];
54
+ yield [ClassicDummy::class.'<int> ' , new Type ('object ' , className: ClassicDummy::class, genericParameterTypes: [new Type ('int ' )])];
55
55
yield [
56
56
ClassicDummy::class.'<int<?bool>> ' ,
57
57
new Type (
58
58
'object ' ,
59
59
className: ClassicDummy::class,
60
- isGeneric: true ,
61
- genericParameterTypes: [new Type ('int ' , isGeneric: true , genericParameterTypes: [new Type ('bool ' , isNullable: true )])],
60
+ genericParameterTypes: [new Type ('int ' , genericParameterTypes: [new Type ('bool ' , isNullable: true )])],
62
61
),
63
62
];
64
63
65
64
// collection types
66
65
yield ['array ' , new Type ('array ' )];
67
- yield ['array<int, int> ' , new Type ('array ' , isGeneric: true , genericParameterTypes: [new Type ('int ' ), new Type ('int ' )])];
68
- yield ['array<int, float> ' , new Type ('array ' , isGeneric: true , genericParameterTypes: [new Type ('int ' ), new Type ('float ' )])];
66
+ yield ['array<int, int> ' , new Type ('array ' , genericParameterTypes: [new Type ('int ' ), new Type ('int ' )])];
67
+ yield ['array<int, float> ' , new Type ('array ' , genericParameterTypes: [new Type ('int ' ), new Type ('float ' )])];
69
68
yield [
70
69
'array<string, array<int, bool>> ' ,
71
70
new Type (
72
71
'array ' ,
73
- isGeneric: true ,
74
72
genericParameterTypes: [
75
73
new Type ('string ' ),
76
- new Type ('array ' , isGeneric: true , genericParameterTypes: [new Type ('int ' ), new Type ('bool ' )]),
74
+ new Type ('array ' , genericParameterTypes: [new Type ('int ' ), new Type ('bool ' )]),
77
75
],
78
76
),
79
77
];
@@ -82,13 +80,11 @@ className: ClassicDummy::class,
82
80
new Type (
83
81
'array ' ,
84
82
isNullable: true ,
85
- isGeneric: true ,
86
83
genericParameterTypes: [
87
84
new Type ('string ' , isNullable: true ),
88
85
new Type (
89
86
'array ' ,
90
87
isNullable: true ,
91
- isGeneric: true ,
92
88
genericParameterTypes: [
93
89
new Type ('int ' , isNullable: true ),
94
90
new Type ('bool ' , isNullable: true ),
@@ -108,23 +104,14 @@ className: ClassicDummy::class,
108
104
unionTypes: [
109
105
new Type (
110
106
'array ' ,
111
- isGeneric: true ,
112
107
genericParameterTypes: [new Type ('string ' ), new Type ('string|float ' , unionTypes: [new Type ('string ' ), new Type ('float ' )])],
113
108
),
114
- new Type ('array ' , isGeneric: true , genericParameterTypes: [new Type ('int ' ), new Type ('bool ' )]),
109
+ new Type ('array ' , genericParameterTypes: [new Type ('int ' ), new Type ('bool ' )]),
115
110
],
116
111
),
117
112
];
118
113
}
119
114
120
- public function testCannotCreateGenericWithoutGenericTypes ()
121
- {
122
- $ this ->expectException (InvalidArgumentException::class);
123
- $ this ->expectExceptionMessage ('Missing generic parameter types of "object" type. ' );
124
-
125
- new Type ('object ' , className: ClassicDummy::class, isGeneric: true , genericParameterTypes: []);
126
- }
127
-
128
115
public function testCannotCreateUnionWithOnlyOneType ()
129
116
{
130
117
$ this ->expectException (InvalidArgumentException::class);
@@ -143,7 +130,7 @@ public function testCannotGetClassNameOnNonObject()
143
130
144
131
public function testGetCollectionKeyType ()
145
132
{
146
- $ this ->assertEquals (new Type ('string ' ), (new Type ('array ' , isGeneric: true , genericParameterTypes: [new Type ('string ' ), new Type ('int ' )]))->collectionKeyType ());
133
+ $ this ->assertEquals (new Type ('string ' ), (new Type ('array ' , genericParameterTypes: [new Type ('string ' ), new Type ('int ' )]))->collectionKeyType ());
147
134
$ this ->assertEquals (new Type ('mixed ' ), (new Type ('array ' ))->collectionKeyType ());
148
135
}
149
136
@@ -157,7 +144,7 @@ public function testCannotGetCollectionKeyTypeOnNonCollection()
157
144
158
145
public function testGetCollectionValueType ()
159
146
{
160
- $ this ->assertEquals (new Type ('int ' ), (new Type ('array ' , isGeneric: true , genericParameterTypes: [new Type ('string ' ), new Type ('int ' )]))->collectionValueType ());
147
+ $ this ->assertEquals (new Type ('int ' ), (new Type ('array ' , genericParameterTypes: [new Type ('string ' ), new Type ('int ' )]))->collectionValueType ());
161
148
$ this ->assertEquals (new Type ('mixed ' ), (new Type ('array ' ))->collectionValueType ());
162
149
}
163
150
@@ -307,7 +294,7 @@ public static function isserDataProvider(): iterable
307
294
'union ' => false ,
308
295
];
309
296
yield [
310
- 'type ' => new Type ('object ' , className: ClassicDummy::class, isGeneric: true , genericParameterTypes: [new Type ('int ' )]),
297
+ 'type ' => new Type ('object ' , className: ClassicDummy::class, genericParameterTypes: [new Type ('int ' )]),
311
298
'scalar ' => false ,
312
299
'null ' => false ,
313
300
'nullable ' => false ,
@@ -320,7 +307,7 @@ public static function isserDataProvider(): iterable
320
307
'union ' => false ,
321
308
];
322
309
yield [
323
- 'type ' => new Type ('array ' , isGeneric: true , genericParameterTypes: [new Type ('int ' ), new Type ('int ' )]),
310
+ 'type ' => new Type ('array ' , genericParameterTypes: [new Type ('int ' ), new Type ('int ' )]),
324
311
'scalar ' => false ,
325
312
'null ' => false ,
326
313
'nullable ' => false ,
@@ -333,7 +320,7 @@ public static function isserDataProvider(): iterable
333
320
'union ' => false ,
334
321
];
335
322
yield [
336
- 'type ' => new Type ('array ' , isGeneric: true , genericParameterTypes: [new Type ('string ' ), new Type ('int ' )]),
323
+ 'type ' => new Type ('array ' , genericParameterTypes: [new Type ('string ' ), new Type ('int ' )]),
337
324
'scalar ' => false ,
338
325
'null ' => false ,
339
326
'nullable ' => false ,
0 commit comments