File tree Expand file tree Collapse file tree 4 files changed +43
-3
lines changed
modules/openapi-generator/src/main/resources/php
samples/client/petstore/php/OpenAPIClient-php Expand file tree Collapse file tree 4 files changed +43
-3
lines changed Original file line number Diff line number Diff line change @@ -260,7 +260,7 @@ class ObjectSerializer
260
260
} elseif (is_bool($value)) {
261
261
return $value ? ' true' : ' false' ;
262
262
} else {
263
- return $value ;
263
+ return (string) $value ;
264
264
}
265
265
}
266
266
Original file line number Diff line number Diff line change @@ -59,14 +59,14 @@ docs/Model/SpecialModelName.md
59
59
docs/Model/Tag.md
60
60
docs/Model/User.md
61
61
git_push.sh
62
+ lib/ApiException.php
62
63
lib/Api/AnotherFakeApi.php
63
64
lib/Api/DefaultApi.php
64
65
lib/Api/FakeApi.php
65
66
lib/Api/FakeClassnameTags123Api.php
66
67
lib/Api/PetApi.php
67
68
lib/Api/StoreApi.php
68
69
lib/Api/UserApi.php
69
- lib/ApiException.php
70
70
lib/Configuration.php
71
71
lib/HeaderSelector.php
72
72
lib/Model/AdditionalPropertiesClass.php
Original file line number Diff line number Diff line change @@ -269,7 +269,7 @@ public static function toString($value)
269
269
} elseif (is_bool ($ value )) {
270
270
return $ value ? 'true ' : 'false ' ;
271
271
} else {
272
- return $ value ;
272
+ return ( string ) $ value ;
273
273
}
274
274
}
275
275
Original file line number Diff line number Diff line change @@ -334,4 +334,44 @@ public function provideDeepObjects(): array
334
334
],
335
335
];
336
336
}
337
+
338
+ /**
339
+ * @dataProvider provideToStringInput
340
+ */
341
+ public function testToString ($ input , string $ expected ): void
342
+ {
343
+ $ result = ObjectSerializer::toString ($ input );
344
+
345
+ $ this ->assertSame ($ expected , $ result );
346
+ }
347
+
348
+ public function provideToStringInput (): array
349
+ {
350
+ return [
351
+ 'int ' => [
352
+ 'input ' => 1 ,
353
+ 'expected ' => '1 ' ,
354
+ ],
355
+ 'int 0 ' => [
356
+ 'input ' => 0 ,
357
+ 'expected ' => '0 ' ,
358
+ ],
359
+ 'false ' => [
360
+ 'input ' => false ,
361
+ 'expected ' => 'false ' ,
362
+ ],
363
+ 'true ' => [
364
+ 'input ' => true ,
365
+ 'expected ' => 'true ' ,
366
+ ],
367
+ 'some string ' => [
368
+ 'input ' => 'some string ' ,
369
+ 'expected ' => 'some string ' ,
370
+ ],
371
+ 'a date ' => [
372
+ 'input ' => new \DateTime ('14-04-2022 ' ),
373
+ 'expected ' => '2022-04-14T00:00:00+00:00 ' ,
374
+ ],
375
+ ];
376
+ }
337
377
}
You can’t perform that action at this time.
0 commit comments