@@ -128,35 +128,30 @@ public static function selectFromArgs(
128
128
if (count ($ args ) >= 3 && (bool ) $ args [0 ]->getAttribute (CurlSetOptArgVisitor::ATTRIBUTE_NAME )) {
129
129
$ optType = $ scope ->getType ($ args [1 ]->value );
130
130
131
- $ optValueType = null ;
131
+ $ valueTypes = [] ;
132
132
foreach ($ optType ->getConstantScalarValues () as $ scalarValue ) {
133
133
if (!is_int ($ scalarValue )) {
134
- $ optValueType = null ;
134
+ $ valueTypes = [] ;
135
135
break ;
136
136
}
137
137
138
138
$ valueType = self ::getCurlOptValueType ($ scalarValue );
139
139
if ($ valueType === null ) {
140
- $ optValueType = null ;
140
+ $ valueTypes = [] ;
141
141
break ;
142
142
}
143
143
144
- if ($ optValueType === null ) {
145
- $ optValueType = $ valueType ;
146
- continue ;
147
- }
148
-
149
- $ optValueType = TypeCombinator::union ($ optValueType , $ valueType );
144
+ $ valueTypes [] = $ valueType ;
150
145
}
151
146
152
- if ($ optValueType !== null ) {
147
+ if (count ( $ valueTypes ) !== 0 ) {
153
148
$ acceptor = $ parametersAcceptors [0 ];
154
149
$ parameters = $ acceptor ->getParameters ();
155
150
156
151
$ parameters [2 ] = new NativeParameterReflection (
157
152
$ parameters [2 ]->getName (),
158
153
$ parameters [2 ]->isOptional (),
159
- $ optValueType ,
154
+ TypeCombinator:: union (... $ valueTypes ) ,
160
155
$ parameters [2 ]->passedByReference (),
161
156
$ parameters [2 ]->isVariadic (),
162
157
$ parameters [2 ]->getDefaultValue (),
0 commit comments