Skip to content

Commit 0338bde

Browse files
committed
Cast to int in HeaderSelector::getNextWeight()
1 parent 4a7e0c9 commit 0338bde

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

modules/openapi-generator/src/main/resources/php-nextgen/HeaderSelector.mustache

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff 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;

samples/client/echo_api/php-nextgen-streaming/src/HeaderSelector.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,12 @@ private function adjustWeight(array $headers, float &$currentWeight, bool $hasMo
195195

196196
/**
197197
* @param string $header
198-
* @param int $weight
198+
* @param float $weight
199199
* @return string
200200
*/
201-
private function buildAcceptHeader(string $header, int $weight): string
201+
private function buildAcceptHeader(string $header, float $weight): string
202202
{
203-
if($weight === 1000) {
203+
if ($weight === 1000.0) {
204204
return $header;
205205
}
206206

@@ -225,11 +225,11 @@ private function buildAcceptHeader(string $header, int $weight): string
225225
* 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
226226
* decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc.
227227
*
228-
* @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value)
229-
* @param bool $hasMoreThan28Headers
230-
* @return int
228+
* @param float $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value)
229+
* @param bool $hasMoreThan28Headers
230+
* @return float
231231
*/
232-
public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int
232+
public function getNextWeight(float $currentWeight, bool $hasMoreThan28Headers): float
233233
{
234234
if ($currentWeight <= 1) {
235235
return 1;

samples/client/echo_api/php-nextgen/src/HeaderSelector.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,12 @@ private function adjustWeight(array $headers, float &$currentWeight, bool $hasMo
195195

196196
/**
197197
* @param string $header
198-
* @param int $weight
198+
* @param float $weight
199199
* @return string
200200
*/
201-
private function buildAcceptHeader(string $header, int $weight): string
201+
private function buildAcceptHeader(string $header, float $weight): string
202202
{
203-
if($weight === 1000) {
203+
if ($weight === 1000.0) {
204204
return $header;
205205
}
206206

@@ -225,11 +225,11 @@ private function buildAcceptHeader(string $header, int $weight): string
225225
* 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
226226
* decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc.
227227
*
228-
* @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value)
229-
* @param bool $hasMoreThan28Headers
230-
* @return int
228+
* @param float $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value)
229+
* @param bool $hasMoreThan28Headers
230+
* @return float
231231
*/
232-
public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int
232+
public function getNextWeight(float $currentWeight, bool $hasMoreThan28Headers): float
233233
{
234234
if ($currentWeight <= 1) {
235235
return 1;

samples/client/petstore/php-nextgen/OpenAPIClient-php/src/HeaderSelector.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,12 @@ private function adjustWeight(array $headers, float &$currentWeight, bool $hasMo
194194

195195
/**
196196
* @param string $header
197-
* @param int $weight
197+
* @param float $weight
198198
* @return string
199199
*/
200-
private function buildAcceptHeader(string $header, int $weight): string
200+
private function buildAcceptHeader(string $header, float $weight): string
201201
{
202-
if($weight === 1000) {
202+
if ($weight === 1000.0) {
203203
return $header;
204204
}
205205

@@ -224,11 +224,11 @@ private function buildAcceptHeader(string $header, int $weight): string
224224
* 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
225225
* decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc.
226226
*
227-
* @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value)
228-
* @param bool $hasMoreThan28Headers
229-
* @return int
227+
* @param float $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value)
228+
* @param bool $hasMoreThan28Headers
229+
* @return float
230230
*/
231-
public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int
231+
public function getNextWeight(float $currentWeight, bool $hasMoreThan28Headers): float
232232
{
233233
if ($currentWeight <= 1) {
234234
return 1;

0 commit comments

Comments
 (0)