From e31c71f68543b9634551d01f213ddd701e9674db Mon Sep 17 00:00:00 2001 From: Kim Sondrup Date: Fri, 13 May 2016 10:54:29 +0200 Subject: [PATCH] [PHP] list_invalid_properties now don't call undefined variables --- .../src/main/resources/php/model.mustache | 14 ++++---- .../SwaggerClient-php/lib/Model/Animal.php | 2 +- .../SwaggerClient-php/lib/Model/EnumTest.php | 6 ++-- .../lib/Model/FormatTest.php | 34 +++++++++---------- .../php/SwaggerClient-php/lib/Model/Name.php | 2 +- .../php/SwaggerClient-php/lib/Model/Order.php | 2 +- .../php/SwaggerClient-php/lib/Model/Pet.php | 6 ++-- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index 6dbf2544a17..d19ae545402 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -161,39 +161,39 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple {{#vars}} {{#required}} if ($this->container['{{name}}'] === null) { - $invalid_properties[] = "'${{name}}' can't be null"; + $invalid_properties[] = "'{{name}}' can't be null"; } {{/required}} {{#isEnum}} $allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); if (!in_array($this->container['{{name}}'], $allowed_values)) { - $invalid_properties[] = "invalid value for '${{name}}', must be one of #{allowed_values}."; + $invalid_properties[] = "invalid value for '{{name}}', must be one of #{allowed_values}."; } {{/isEnum}} {{#hasValidation}} {{#maxLength}} if (strlen($this->container['{{name}}']) > {{maxLength}}) { - $invalid_properties[] = "invalid value for '${{name}}', the character length must be smaller than or equal to {{{maxLength}}}."; + $invalid_properties[] = "invalid value for '{{name}}', the character length must be smaller than or equal to {{{maxLength}}}."; } {{/maxLength}} {{#minLength}} if (strlen($this->container['{{name}}']) < {{minLength}}) { - $invalid_properties[] = "invalid value for '${{name}}', the character length must be bigger than or equal to {{{minLength}}}."; + $invalid_properties[] = "invalid value for '{{name}}', the character length must be bigger than or equal to {{{minLength}}}."; } {{/minLength}} {{#maximum}} if ($this->container['{{name}}'] > {{maximum}}) { - $invalid_properties[] = "invalid value for '${{name}}', must be smaller than or equal to {{maximum}}."; + $invalid_properties[] = "invalid value for '{{name}}', must be smaller than or equal to {{maximum}}."; } {{/maximum}} {{#minimum}} if ($this->container['{{name}}'] < {{minimum}}) { - $invalid_properties[] = "invalid value for '${{name}}', must be bigger than or equal to {{minimum}}."; + $invalid_properties[] = "invalid value for '{{name}}', must be bigger than or equal to {{minimum}}."; } {{/minimum}} {{#pattern}} if (!preg_match("{{pattern}}", $this->container['{{name}}'])) { - $invalid_properties[] = "invalid value for '${{name}}', must be conform to the pattern {{pattern}}."; + $invalid_properties[] = "invalid value for '{{name}}', must be conform to the pattern {{pattern}}."; } {{/pattern}} {{/hasValidation}} diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php index 9120535bf5a..d79d3c92ab9 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -138,7 +138,7 @@ class Animal implements ArrayAccess { $invalid_properties = array(); if ($this->container['class_name'] === null) { - $invalid_properties[] = "'$class_name' can't be null"; + $invalid_properties[] = "'class_name' can't be null"; } return $invalid_properties; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php index 6e10f45dd8f..015297084e9 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php @@ -179,15 +179,15 @@ class EnumTest implements ArrayAccess $invalid_properties = array(); $allowed_values = array("UPPER", "lower"); if (!in_array($this->container['enum_string'], $allowed_values)) { - $invalid_properties[] = "invalid value for '$enum_string', must be one of #{allowed_values}."; + $invalid_properties[] = "invalid value for 'enum_string', must be one of #{allowed_values}."; } $allowed_values = array("1", "-1"); if (!in_array($this->container['enum_integer'], $allowed_values)) { - $invalid_properties[] = "invalid value for '$enum_integer', must be one of #{allowed_values}."; + $invalid_properties[] = "invalid value for 'enum_integer', must be one of #{allowed_values}."; } $allowed_values = array("1.1", "-1.2"); if (!in_array($this->container['enum_number'], $allowed_values)) { - $invalid_properties[] = "invalid value for '$enum_number', must be one of #{allowed_values}."; + $invalid_properties[] = "invalid value for 'enum_number', must be one of #{allowed_values}."; } return $invalid_properties; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php index bf674b05102..3f05fe276ea 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -189,55 +189,55 @@ class FormatTest implements ArrayAccess { $invalid_properties = array(); if ($this->container['integer'] > 100.0) { - $invalid_properties[] = "invalid value for '$integer', must be smaller than or equal to 100.0."; + $invalid_properties[] = "invalid value for 'integer', must be smaller than or equal to 100.0."; } if ($this->container['integer'] < 10.0) { - $invalid_properties[] = "invalid value for '$integer', must be bigger than or equal to 10.0."; + $invalid_properties[] = "invalid value for 'integer', must be bigger than or equal to 10.0."; } if ($this->container['int32'] > 200.0) { - $invalid_properties[] = "invalid value for '$int32', must be smaller than or equal to 200.0."; + $invalid_properties[] = "invalid value for 'int32', must be smaller than or equal to 200.0."; } if ($this->container['int32'] < 20.0) { - $invalid_properties[] = "invalid value for '$int32', must be bigger than or equal to 20.0."; + $invalid_properties[] = "invalid value for 'int32', must be bigger than or equal to 20.0."; } if ($this->container['number'] === null) { - $invalid_properties[] = "'$number' can't be null"; + $invalid_properties[] = "'number' can't be null"; } if ($this->container['number'] > 543.2) { - $invalid_properties[] = "invalid value for '$number', must be smaller than or equal to 543.2."; + $invalid_properties[] = "invalid value for 'number', must be smaller than or equal to 543.2."; } if ($this->container['number'] < 32.1) { - $invalid_properties[] = "invalid value for '$number', must be bigger than or equal to 32.1."; + $invalid_properties[] = "invalid value for 'number', must be bigger than or equal to 32.1."; } if ($this->container['float'] > 987.6) { - $invalid_properties[] = "invalid value for '$float', must be smaller than or equal to 987.6."; + $invalid_properties[] = "invalid value for 'float', must be smaller than or equal to 987.6."; } if ($this->container['float'] < 54.3) { - $invalid_properties[] = "invalid value for '$float', must be bigger than or equal to 54.3."; + $invalid_properties[] = "invalid value for 'float', must be bigger than or equal to 54.3."; } if ($this->container['double'] > 123.4) { - $invalid_properties[] = "invalid value for '$double', must be smaller than or equal to 123.4."; + $invalid_properties[] = "invalid value for 'double', must be smaller than or equal to 123.4."; } if ($this->container['double'] < 67.8) { - $invalid_properties[] = "invalid value for '$double', must be bigger than or equal to 67.8."; + $invalid_properties[] = "invalid value for 'double', must be bigger than or equal to 67.8."; } if (!preg_match("/[a-z]/i", $this->container['string'])) { - $invalid_properties[] = "invalid value for '$string', must be conform to the pattern /[a-z]/i."; + $invalid_properties[] = "invalid value for 'string', must be conform to the pattern /[a-z]/i."; } if ($this->container['byte'] === null) { - $invalid_properties[] = "'$byte' can't be null"; + $invalid_properties[] = "'byte' can't be null"; } if ($this->container['date'] === null) { - $invalid_properties[] = "'$date' can't be null"; + $invalid_properties[] = "'date' can't be null"; } if ($this->container['password'] === null) { - $invalid_properties[] = "'$password' can't be null"; + $invalid_properties[] = "'password' can't be null"; } if (strlen($this->container['password']) > 64) { - $invalid_properties[] = "invalid value for '$password', the character length must be smaller than or equal to 64."; + $invalid_properties[] = "invalid value for 'password', the character length must be smaller than or equal to 64."; } if (strlen($this->container['password']) < 10) { - $invalid_properties[] = "invalid value for '$password', the character length must be bigger than or equal to 10."; + $invalid_properties[] = "invalid value for 'password', the character length must be bigger than or equal to 10."; } return $invalid_properties; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php index b77f3d78d0c..e377c39ffe9 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -144,7 +144,7 @@ class Name implements ArrayAccess { $invalid_properties = array(); if ($this->container['name'] === null) { - $invalid_properties[] = "'$name' can't be null"; + $invalid_properties[] = "'name' can't be null"; } return $invalid_properties; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php index 88779ed8c73..d681a74d2ca 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -170,7 +170,7 @@ class Order implements ArrayAccess $invalid_properties = array(); $allowed_values = array("placed", "approved", "delivered"); if (!in_array($this->container['status'], $allowed_values)) { - $invalid_properties[] = "invalid value for '$status', must be one of #{allowed_values}."; + $invalid_properties[] = "invalid value for 'status', must be one of #{allowed_values}."; } return $invalid_properties; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php index 5a65e432538..6855bb38048 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -169,14 +169,14 @@ class Pet implements ArrayAccess { $invalid_properties = array(); if ($this->container['name'] === null) { - $invalid_properties[] = "'$name' can't be null"; + $invalid_properties[] = "'name' can't be null"; } if ($this->container['photo_urls'] === null) { - $invalid_properties[] = "'$photo_urls' can't be null"; + $invalid_properties[] = "'photo_urls' can't be null"; } $allowed_values = array("available", "pending", "sold"); if (!in_array($this->container['status'], $allowed_values)) { - $invalid_properties[] = "invalid value for '$status', must be one of #{allowed_values}."; + $invalid_properties[] = "invalid value for 'status', must be one of #{allowed_values}."; } return $invalid_properties; }