Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHP] Remove unnecessary IF statement #421

Merged
merged 2 commits into from
Jun 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0-SNAPSHOT
3.1.0-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: [email protected] *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.0.0-SNAPSHOT
* OpenAPI Generator version: 3.1.0-SNAPSHOT
*/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: [email protected] *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.0.0-SNAPSHOT
* OpenAPI Generator version: 3.1.0-SNAPSHOT
*/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: [email protected] *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.0.0-SNAPSHOT
* OpenAPI Generator version: 3.1.0-SNAPSHOT
*/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: [email protected] *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.0.0-SNAPSHOT
* OpenAPI Generator version: 3.1.0-SNAPSHOT
*/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: [email protected] *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.0.0-SNAPSHOT
* OpenAPI Generator version: 3.1.0-SNAPSHOT
*/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: [email protected] *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.0.0-SNAPSHOT
* OpenAPI Generator version: 3.1.0-SNAPSHOT
*/

/**
Expand Down Expand Up @@ -288,14 +288,10 @@ public function offsetUnset($offset)
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: [email protected] *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.0.0-SNAPSHOT
* OpenAPI Generator version: 3.1.0-SNAPSHOT
*/

/**
Expand Down Expand Up @@ -223,7 +223,7 @@ public static function serializeCollection(array $collection, $collectionFormat,
* @param string[] $httpHeaders HTTP headers
* @param string $discriminator discriminator if polymorphism is used
*
* @return object|array|null an single or an array of $class instances
* @return object|array|null a single or an array of $class instances
*/
public static function deserialize($data, $class, $httpHeaders = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,10 @@ public function offsetUnset($offset)
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,10 @@ public function offsetUnset($offset)
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,10 @@ public function offsetUnset($offset)
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,10 @@ public function offsetUnset($offset)
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,10 @@ public function offsetUnset($offset)
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,10 @@ public function offsetUnset($offset)
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,10 @@ public function offsetUnset($offset)
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,14 +437,10 @@ public function offsetUnset($offset)
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}

Expand Down
12 changes: 4 additions & 8 deletions samples/client/petstore/php/OpenAPIClient-php/lib/Model/Cat.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,10 @@ public function offsetUnset($offset)
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,10 @@ public function offsetUnset($offset)
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,10 @@ public function offsetUnset($offset)
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,10 @@ public function offsetUnset($offset)
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}

Expand Down
12 changes: 4 additions & 8 deletions samples/client/petstore/php/OpenAPIClient-php/lib/Model/Dog.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,10 @@ public function offsetUnset($offset)
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,10 @@ public function offsetUnset($offset)
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,14 +542,10 @@ public function offsetUnset($offset)
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}

return json_encode(ObjectSerializer::sanitizeForSerialization($this));
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}

Expand Down
Loading