From 211c8815a298f3e8d86c8c90c0c309f87eefec3b Mon Sep 17 00:00:00 2001 From: ackintosh Date: Fri, 7 Sep 2018 13:27:32 +0900 Subject: [PATCH 1/3] Drop suport for PHP5.5 on php-client --- .../openapi-generator/src/main/resources/php/composer.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/php/composer.mustache b/modules/openapi-generator/src/main/resources/php/composer.mustache index 308241e0a00a..e4860c99bf18 100644 --- a/modules/openapi-generator/src/main/resources/php/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php/composer.mustache @@ -21,7 +21,7 @@ } ], "require": { - "php": ">=5.5", + "php": ">=5.6", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", From d499388f1ee3dc59f8618a6b36ed9a2f3ddf7d22 Mon Sep 17 00:00:00 2001 From: ackintosh Date: Fri, 7 Sep 2018 13:37:04 +0900 Subject: [PATCH 2/3] Update samples bin/php-petstore.sh bin/openapi3/php-petstore.sh --- samples/client/petstore/php/OpenAPIClient-php/composer.json | 2 +- .../client/petstore/php/OpenAPIClient-php/composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/client/petstore/php/OpenAPIClient-php/composer.json b/samples/client/petstore/php/OpenAPIClient-php/composer.json index 834ab01d201f..45b3c6972619 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/composer.json +++ b/samples/client/petstore/php/OpenAPIClient-php/composer.json @@ -18,7 +18,7 @@ } ], "require": { - "php": ">=5.5", + "php": ">=5.6", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/composer.json b/samples/openapi3/client/petstore/php/OpenAPIClient-php/composer.json index 834ab01d201f..45b3c6972619 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/composer.json +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/composer.json @@ -18,7 +18,7 @@ } ], "require": { - "php": ">=5.5", + "php": ">=5.6", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", From 8fcd80805a48e5054ab284fae3fdf03851867e85 Mon Sep 17 00:00:00 2001 From: ackintosh Date: Fri, 7 Sep 2018 13:38:20 +0900 Subject: [PATCH 3/3] Update security samples bin/security/php-petstore.sh --- .../php/OpenAPIClient-php/.gitignore | 8 +++++ .../.openapi-generator/VERSION | 2 +- .../php/OpenAPIClient-php/.php_cs | 33 +++++++++++-------- .../php/OpenAPIClient-php/composer.json | 4 +-- .../php/OpenAPIClient-php/lib/Api/FakeApi.php | 2 +- .../OpenAPIClient-php/lib/ApiException.php | 2 +- .../OpenAPIClient-php/lib/Configuration.php | 2 +- .../OpenAPIClient-php/lib/HeaderSelector.php | 2 +- .../lib/Model/ModelInterface.php | 2 +- .../lib/Model/ModelReturn.php | 2 +- .../lib/ObjectSerializer.php | 6 ++-- 11 files changed, 39 insertions(+), 26 deletions(-) create mode 100644 samples/client/petstore-security-test/php/OpenAPIClient-php/.gitignore diff --git a/samples/client/petstore-security-test/php/OpenAPIClient-php/.gitignore b/samples/client/petstore-security-test/php/OpenAPIClient-php/.gitignore new file mode 100644 index 000000000000..edcf63f6aee1 --- /dev/null +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/.gitignore @@ -0,0 +1,8 @@ +# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore + +composer.phar +/vendor/ + +# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control +# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file +composer.lock \ No newline at end of file diff --git a/samples/client/petstore-security-test/php/OpenAPIClient-php/.openapi-generator/VERSION b/samples/client/petstore-security-test/php/OpenAPIClient-php/.openapi-generator/VERSION index 4395ff592326..6d94c9c2e12a 100644 --- a/samples/client/petstore-security-test/php/OpenAPIClient-php/.openapi-generator/VERSION +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore-security-test/php/OpenAPIClient-php/.php_cs b/samples/client/petstore-security-test/php/OpenAPIClient-php/.php_cs index 6b8e23c818a9..4fbe53ec5ff1 100644 --- a/samples/client/petstore-security-test/php/OpenAPIClient-php/.php_cs +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/.php_cs @@ -1,18 +1,23 @@ level(Symfony\CS\FixerInterface::PSR2_LEVEL) +return PhpCsFixer\Config::create() ->setUsingCache(true) - ->fixers( - [ - 'ordered_use', - 'phpdoc_order', - 'short_array_syntax', - 'strict', - 'strict_param' - ] - ) - ->finder( - Symfony\CS\Finder\DefaultFinder::create() - ->in(__DIR__) + ->setRules([ + '@PSR2' => true, + 'ordered_imports' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('test') + ->exclude('tests') + ->in(__DIR__) ); diff --git a/samples/client/petstore-security-test/php/OpenAPIClient-php/composer.json b/samples/client/petstore-security-test/php/OpenAPIClient-php/composer.json index 65d3c935fb88..45b3c6972619 100644 --- a/samples/client/petstore-security-test/php/OpenAPIClient-php/composer.json +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/composer.json @@ -18,7 +18,7 @@ } ], "require": { - "php": ">=5.5", + "php": ">=5.6", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", @@ -27,7 +27,7 @@ "require-dev": { "phpunit/phpunit": "^4.8", "squizlabs/php_codesniffer": "~2.6", - "friendsofphp/php-cs-fixer": "~1.12" + "friendsofphp/php-cs-fixer": "~2.12" }, "autoload": { "psr-4": { "OpenAPI\\Client\\" : "lib/" } diff --git a/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/Api/FakeApi.php index 863943a0292b..b8df0f363deb 100644 --- a/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -17,7 +17,7 @@ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 3.2.0-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT */ /** diff --git a/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/ApiException.php b/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/ApiException.php index a8a729d0026c..516981727ba1 100644 --- a/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/ApiException.php +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/ApiException.php @@ -17,7 +17,7 @@ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 3.2.0-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT */ /** diff --git a/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/Configuration.php b/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/Configuration.php index f0de03c2a0d3..38464086bf4e 100644 --- a/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/Configuration.php +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/Configuration.php @@ -17,7 +17,7 @@ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 3.2.0-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT */ /** diff --git a/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/HeaderSelector.php b/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/HeaderSelector.php index e17ea33291e7..0a183e1a9ceb 100644 --- a/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/HeaderSelector.php +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/HeaderSelector.php @@ -17,7 +17,7 @@ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 3.2.0-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT */ /** diff --git a/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/Model/ModelInterface.php b/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/Model/ModelInterface.php index 53010cf2227f..2970c2b72c03 100644 --- a/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/Model/ModelInterface.php +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/Model/ModelInterface.php @@ -18,7 +18,7 @@ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 3.2.0-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT */ /** diff --git a/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/Model/ModelReturn.php b/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/Model/ModelReturn.php index d06063968bb3..97a18252d864 100644 --- a/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/Model/ModelReturn.php @@ -18,7 +18,7 @@ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 3.2.0-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT */ /** diff --git a/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/ObjectSerializer.php b/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/ObjectSerializer.php index 9d90b816e09c..f2142a2e86e5 100644 --- a/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/lib/ObjectSerializer.php @@ -18,7 +18,7 @@ * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 3.2.0-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT */ /** @@ -68,7 +68,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n if ($value !== null && !in_array($openAPIType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true) && method_exists($openAPIType, 'getAllowableEnumValues') - && !in_array($value, $openAPIType::getAllowableEnumValues())) { + && !in_array($value, $openAPIType::getAllowableEnumValues(), true)) { $imploded = implode("', '", $openAPIType::getAllowableEnumValues()); throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); } @@ -287,7 +287,7 @@ public static function deserialize($data, $class, $httpHeaders = null) return new \SplFileObject($filename, 'r'); } elseif (method_exists($class, 'getAllowableEnumValues')) { - if (!in_array($data, $class::getAllowableEnumValues())) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { $imploded = implode("', '", $class::getAllowableEnumValues()); throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); }