Skip to content

Commit

Permalink
Fix CURLOPT_POSTFIELDS param type
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedash95 committed Oct 1, 2022
1 parent 5886120 commit e515b25
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Reflection/ParametersAcceptorSelector.php
Expand Up @@ -646,7 +646,6 @@ private static function getCurlOptValueType(int $curlOpt): ?Type
'CURLOPT_KRB4LEVEL',
'CURLOPT_LOGIN_OPTIONS',
'CURLOPT_PINNEDPUBLICKEY',
'CURLOPT_POSTFIELDS',
'CURLOPT_PRIVATE',
'CURLOPT_PRE_PROXY',
'CURLOPT_PROXY',
Expand Down Expand Up @@ -724,6 +723,18 @@ private static function getCurlOptValueType(int $curlOpt): ?Type
}
}

$arrayOrStringConstants = [
'CURLOPT_POSTFIELDS',
];
foreach ($arrayOrStringConstants as $constName) {
if (defined($constName) && constant($constName) === $curlOpt) {
return TypeCombinator::union(
new StringType(),
new ArrayType(new MixedType(), new MixedType()),
);
}
}

$resourceConstants = [
'CURLOPT_FILE',
'CURLOPT_INFILE',
Expand Down

0 comments on commit e515b25

Please sign in to comment.