fix #1272 Fix wrong PHP Symfony typehint (#1453)

A model with an array property used to have the wrong PHP typehint in
the setter: the array item object type instead of "array"
This commit is contained in:
Ludovic Montel 2018-11-18 05:38:44 +01:00 committed by William Cheng
parent 2c418e1b71
commit 7f8ff35245
2 changed files with 6 additions and 2 deletions

View File

@ -424,6 +424,10 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg
var.vendorExtensions.put("x-parameterType", typeHint);
}
if (var.isContainer) {
var.vendorExtensions.put("x-parameterType", getTypeHint(var.dataType + "[]"));
}
// Create a variable to display the correct data type in comments for models
var.vendorExtensions.put("x-commentType", var.dataType);
if (var.isContainer) {

View File

@ -203,7 +203,7 @@ class Pet
*
* @return $this
*/
public function setPhotoUrls($photoUrls)
public function setPhotoUrls(array $photoUrls)
{
$this->photoUrls = $photoUrls;
@ -227,7 +227,7 @@ class Pet
*
* @return $this
*/
public function setTags(Tag $tags = null)
public function setTags(array $tags = null)
{
$this->tags = $tags;