From 4a8260153afd3f537829cd78f7b7663296dbc097 Mon Sep 17 00:00:00 2001 From: Yuriy Belenko Date: Sun, 22 Jan 2023 02:06:09 +0300 Subject: [PATCH] Add phplint package --- .../codegen/languages/PhpNextgenClientCodegen.java | 1 + .../main/resources/php-nextgen/.phplint.mustache | 11 +++++++++++ .../main/resources/php-nextgen/composer.mustache | 11 +++++++++-- .../src/main/resources/php-nextgen/gitignore | 3 +++ .../php-nextgen/OpenAPIClient-php/.gitignore | 3 +++ .../OpenAPIClient-php/.openapi-generator/FILES | 1 + .../php-nextgen/OpenAPIClient-php/.phplint.dist.yml | 12 ++++++++++++ .../php-nextgen/OpenAPIClient-php/.phplint.yml | 11 +++++++++++ .../php-nextgen/OpenAPIClient-php/composer.json | 11 +++++++++-- .../petstore/php-nextgen/OpenAPIClient-php/pom.xml | 13 +++++++++++++ 10 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/php-nextgen/.phplint.mustache create mode 100644 samples/client/petstore/php-nextgen/OpenAPIClient-php/.phplint.dist.yml create mode 100644 samples/client/petstore/php-nextgen/OpenAPIClient-php/.phplint.yml diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java index a4aa054e8696..18f13df361c8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java @@ -115,6 +115,7 @@ public void processOpts() { supportingFiles.add(new SupportingFile("phpunit.xml.mustache", "", "phpunit.xml.dist")); supportingFiles.add(new SupportingFile(".travis.yml", "", ".travis.yml")); supportingFiles.add(new SupportingFile(".php-cs-fixer.dist.php", "", ".php-cs-fixer.dist.php")); + supportingFiles.add(new SupportingFile(".phplint.mustache", "", ".phplint.yml")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); } } diff --git a/modules/openapi-generator/src/main/resources/php-nextgen/.phplint.mustache b/modules/openapi-generator/src/main/resources/php-nextgen/.phplint.mustache new file mode 100644 index 000000000000..583b66a34a49 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-nextgen/.phplint.mustache @@ -0,0 +1,11 @@ +path: + - ./{{srcBasePath}} + - ./{{testBasePath}} +jobs: 10 +extensions: + - php +exclude: + - vendor +warning: true +memory-limit: -1 +no-cache: true diff --git a/modules/openapi-generator/src/main/resources/php-nextgen/composer.mustache b/modules/openapi-generator/src/main/resources/php-nextgen/composer.mustache index 82c972f0060a..e68bf85c5b8a 100644 --- a/modules/openapi-generator/src/main/resources/php-nextgen/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php-nextgen/composer.mustache @@ -32,13 +32,20 @@ "guzzlehttp/psr7": "^2.0" }, "require-dev": { - "phpunit/phpunit": "^9.0", - "friendsofphp/php-cs-fixer": "^3.5" + "friendsofphp/php-cs-fixer": "^3.5", + "overtrue/phplint": "^9.0", + "phpunit/phpunit": "^9.0" }, "autoload": { "psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" } }, "autoload-dev": { "psr-4": { "{{escapedInvokerPackage}}\\Test\\" : "{{testBasePath}}/" } + }, + "scripts": { + "test": [ + "@phplint" + ], + "phplint": "phplint" } } diff --git a/modules/openapi-generator/src/main/resources/php-nextgen/gitignore b/modules/openapi-generator/src/main/resources/php-nextgen/gitignore index 9f1681c2be8d..91cd7a2f35b0 100644 --- a/modules/openapi-generator/src/main/resources/php-nextgen/gitignore +++ b/modules/openapi-generator/src/main/resources/php-nextgen/gitignore @@ -13,3 +13,6 @@ composer.phar # PHPUnit cache .phpunit.result.cache + +# PHPLint cache +build/phplint.cache diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/.gitignore b/samples/client/petstore/php-nextgen/OpenAPIClient-php/.gitignore index 9f1681c2be8d..91cd7a2f35b0 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/.gitignore +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/.gitignore @@ -13,3 +13,6 @@ composer.phar # PHPUnit cache .phpunit.result.cache + +# PHPLint cache +build/phplint.cache diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/.openapi-generator/FILES b/samples/client/petstore/php-nextgen/OpenAPIClient-php/.openapi-generator/FILES index da556bb1e431..b8a1dd356dc7 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/.openapi-generator/FILES +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/.openapi-generator/FILES @@ -1,5 +1,6 @@ .gitignore .php-cs-fixer.dist.php +.phplint.yml .travis.yml README.md composer.json diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/.phplint.dist.yml b/samples/client/petstore/php-nextgen/OpenAPIClient-php/.phplint.dist.yml new file mode 100644 index 000000000000..2c81c7a43080 --- /dev/null +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/.phplint.dist.yml @@ -0,0 +1,12 @@ +path: + - ./lib + - ./test + - ./tests +jobs: 10 +extensions: + - php +exclude: + - vendor +warning: true +memory-limit: -1 +no-cache: true diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/.phplint.yml b/samples/client/petstore/php-nextgen/OpenAPIClient-php/.phplint.yml new file mode 100644 index 000000000000..b92688be9411 --- /dev/null +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/.phplint.yml @@ -0,0 +1,11 @@ +path: + - ./lib + - ./test +jobs: 10 +extensions: + - php +exclude: + - vendor +warning: true +memory-limit: -1 +no-cache: true diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/composer.json b/samples/client/petstore/php-nextgen/OpenAPIClient-php/composer.json index 683aeb5886bd..4c1386e5958b 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/composer.json +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/composer.json @@ -26,13 +26,20 @@ "guzzlehttp/psr7": "^2.0" }, "require-dev": { - "phpunit/phpunit": "^9.0", - "friendsofphp/php-cs-fixer": "^3.5" + "friendsofphp/php-cs-fixer": "^3.5", + "overtrue/phplint": "^9.0", + "phpunit/phpunit": "^9.0" }, "autoload": { "psr-4": { "OpenAPI\\Client\\" : "lib/" } }, "autoload-dev": { "psr-4": { "OpenAPI\\Client\\Test\\" : "test/" } + }, + "scripts": { + "test": [ + "@phplint" + ], + "phplint": "phplint" } } diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/pom.xml b/samples/client/petstore/php-nextgen/OpenAPIClient-php/pom.xml index d5d32c3bd1bf..bd2c6a1d3df0 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/pom.xml +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/pom.xml @@ -39,6 +39,19 @@ + + check-php-syntax + integration-test + + exec + + + vendor/bin/phplint + + --configuration=phplint.dist.yml + + + bundle-test integration-test