File tree Expand file tree Collapse file tree 4 files changed +17
-17
lines changed
modules/openapi-generator/src/main/resources/php-nextgen
php-nextgen-streaming/src
petstore/php-nextgen/OpenAPIClient-php/src Expand file tree Collapse file tree 4 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -186,12 +186,12 @@ class HeaderSelector
186186
187187 /**
188188 * @param string $header
189- * @param int $weight
189+ * @param float $weight
190190 * @return string
191191 */
192- private function buildAcceptHeader(string $header, int $weight): string
192+ private function buildAcceptHeader(string $header, float $weight): string
193193 {
194- if ($weight === 1000) {
194+ if ($weight === 1000.0 ) {
195195 return $header ;
196196 }
197197
@@ -216,11 +216,11 @@ class HeaderSelector
216216 * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1
217217 * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc.
218218 *
219- * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value)
220- * @param bool $hasMoreThan28Headers
221- * @return int
219+ * @param float $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value)
220+ * @param bool $hasMoreThan28Headers
221+ * @return float
222222 */
223- public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int
223+ public function getNextWeight(float $currentWeight, bool $hasMoreThan28Headers): float
224224 {
225225 if ($currentWeight <= 1) {
226226 return 1;
@@ -230,6 +230,6 @@ class HeaderSelector
230230 return $currentWeight - 1;
231231 }
232232
233- return $currentWeight - 10 ** floor( log10($currentWeight - 1) );
233+ return $currentWeight - 10 ** floor(log10($currentWeight - 1));
234234 }
235235}
Original file line number Diff line number Diff line change @@ -166,11 +166,11 @@ private function getHeaderAndWeight(string $header): array
166166
167167 /**
168168 * @param array[] $headers
169- * @param float $currentWeight
169+ * @param int $currentWeight
170170 * @param bool $hasMoreThan28Headers
171171 * @return string[] array of adjusted "Accept" headers
172172 */
173- private function adjustWeight (array $ headers , float &$ currentWeight , bool $ hasMoreThan28Headers ): array
173+ private function adjustWeight (array $ headers , int &$ currentWeight , bool $ hasMoreThan28Headers ): array
174174 {
175175 usort ($ headers , function (array $ a , array $ b ) {
176176 return $ b ['weight ' ] - $ a ['weight ' ];
@@ -239,6 +239,6 @@ public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): i
239239 return $ currentWeight - 1 ;
240240 }
241241
242- return $ currentWeight - 10 ** floor ( log10 ($ currentWeight - 1 ) );
242+ return ( int ) ( $ currentWeight - 10 ** floor ( log10 ($ currentWeight - 1 ) ) );
243243 }
244244}
Original file line number Diff line number Diff line change @@ -166,11 +166,11 @@ private function getHeaderAndWeight(string $header): array
166166
167167 /**
168168 * @param array[] $headers
169- * @param float $currentWeight
169+ * @param int $currentWeight
170170 * @param bool $hasMoreThan28Headers
171171 * @return string[] array of adjusted "Accept" headers
172172 */
173- private function adjustWeight (array $ headers , float &$ currentWeight , bool $ hasMoreThan28Headers ): array
173+ private function adjustWeight (array $ headers , int &$ currentWeight , bool $ hasMoreThan28Headers ): array
174174 {
175175 usort ($ headers , function (array $ a , array $ b ) {
176176 return $ b ['weight ' ] - $ a ['weight ' ];
@@ -239,6 +239,6 @@ public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): i
239239 return $ currentWeight - 1 ;
240240 }
241241
242- return $ currentWeight - 10 ** floor ( log10 ($ currentWeight - 1 ) );
242+ return ( int ) ( $ currentWeight - 10 ** floor ( log10 ($ currentWeight - 1 ) ) );
243243 }
244244}
Original file line number Diff line number Diff line change @@ -165,11 +165,11 @@ private function getHeaderAndWeight(string $header): array
165165
166166 /**
167167 * @param array[] $headers
168- * @param float $currentWeight
168+ * @param int $currentWeight
169169 * @param bool $hasMoreThan28Headers
170170 * @return string[] array of adjusted "Accept" headers
171171 */
172- private function adjustWeight (array $ headers , float &$ currentWeight , bool $ hasMoreThan28Headers ): array
172+ private function adjustWeight (array $ headers , int &$ currentWeight , bool $ hasMoreThan28Headers ): array
173173 {
174174 usort ($ headers , function (array $ a , array $ b ) {
175175 return $ b ['weight ' ] - $ a ['weight ' ];
@@ -238,6 +238,6 @@ public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): i
238238 return $ currentWeight - 1 ;
239239 }
240240
241- return $ currentWeight - 10 ** floor ( log10 ($ currentWeight - 1 ) );
241+ return ( int ) ( $ currentWeight - 10 ** floor ( log10 ($ currentWeight - 1 ) ) );
242242 }
243243}
You can’t perform that action at this time.
0 commit comments