Skip to content

Commit 2864125

Browse files
authored
Merge pull request #1 from swagger-api/master
updating self
2 parents 4eabc50 + aa87e4f commit 2864125

File tree

15 files changed

+337
-122
lines changed

15 files changed

+337
-122
lines changed
Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
<?php
22

3-
return Symfony\CS\Config::create()
4-
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
3+
return PhpCsFixer\Config::create()
54
->setUsingCache(true)
6-
->fixers(
7-
[
8-
'ordered_use',
9-
'phpdoc_order',
10-
'short_array_syntax',
11-
'strict',
12-
'strict_param'
13-
]
14-
)
15-
->finder(
16-
Symfony\CS\Finder\DefaultFinder::create()
17-
->in(__DIR__)
5+
->setRules([
6+
'@PSR2' => true,
7+
'ordered_imports' => true,
8+
'phpdoc_order' => true,
9+
'array_syntax' => [ 'syntax' => 'short' ],
10+
'strict_comparison' => true,
11+
'strict_param' => true,
12+
'no_trailing_whitespace' => false,
13+
'no_trailing_whitespace_in_comment' => false,
14+
'braces' => false,
15+
'single_blank_line_at_eof' => false,
16+
'blank_line_after_namespace' => false,
17+
])
18+
->setFinder(
19+
PhpCsFixer\Finder::create()
20+
->exclude('test')
21+
->exclude('tests')
22+
->in(__DIR__)
1823
);

modules/swagger-codegen/src/main/resources/php/HeaderSelector.mustache

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,3 @@ class HeaderSelector
9797
}
9898
}
9999
}
100-

modules/swagger-codegen/src/main/resources/php/ObjectSerializer.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ObjectSerializer
5858
if ($value !== null
5959
&& !in_array($swaggerType, [{{&primitives}}], true)
6060
&& method_exists($swaggerType, 'getAllowableEnumValues')
61-
&& !in_array($value, $swaggerType::getAllowableEnumValues())) {
61+
&& !in_array($value, $swaggerType::getAllowableEnumValues(), true)) {
6262
$imploded = implode("', '", $swaggerType::getAllowableEnumValues());
6363
throw new \InvalidArgumentException("Invalid value for enum '$swaggerType', must be one of: '$imploded'");
6464
}
@@ -274,7 +274,7 @@ class ObjectSerializer
274274

275275
return new \SplFileObject($filename, 'r');
276276
} elseif (method_exists($class, 'getAllowableEnumValues')) {
277-
if (!in_array($data, $class::getAllowableEnumValues())) {
277+
if (!in_array($data, $class::getAllowableEnumValues(), true)) {
278278
$imploded = implode("', '", $class::getAllowableEnumValues());
279279
throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'");
280280
}

modules/swagger-codegen/src/main/resources/php/composer.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"require-dev": {
2929
"phpunit/phpunit": "^4.8",
3030
"squizlabs/php_codesniffer": "~2.6",
31-
"friendsofphp/php-cs-fixer": "~1.12"
31+
"friendsofphp/php-cs-fixer": "~2.12"
3232
},
3333
"autoload": {
3434
"psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" }

modules/swagger-codegen/src/main/resources/php/model_generic.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa
166166
{{#discriminator}}
167167

168168
// Initialize discriminator property with the model name.
169-
$discriminator = array_search('{{discriminator}}', self::$attributeMap);
169+
$discriminator = array_search('{{discriminator}}', self::$attributeMap, true);
170170
$this->container[$discriminator] = static::$swaggerModelName;
171171
{{/discriminator}}
172172
}
Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
<?php
22

3-
return Symfony\CS\Config::create()
4-
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
3+
return PhpCsFixer\Config::create()
54
->setUsingCache(true)
6-
->fixers(
7-
[
8-
'ordered_use',
9-
'phpdoc_order',
10-
'short_array_syntax',
11-
'strict',
12-
'strict_param'
13-
]
14-
)
15-
->finder(
16-
Symfony\CS\Finder\DefaultFinder::create()
17-
->in(__DIR__)
5+
->setRules([
6+
'@PSR2' => true,
7+
'ordered_imports' => true,
8+
'phpdoc_order' => true,
9+
'array_syntax' => [ 'syntax' => 'short' ],
10+
'strict_comparison' => true,
11+
'strict_param' => true,
12+
'no_trailing_whitespace' => false,
13+
'no_trailing_whitespace_in_comment' => false,
14+
'braces' => false,
15+
'single_blank_line_at_eof' => false,
16+
'blank_line_after_namespace' => false,
17+
])
18+
->setFinder(
19+
PhpCsFixer\Finder::create()
20+
->exclude('test')
21+
->exclude('tests')
22+
->in(__DIR__)
1823
);

samples/client/petstore/php/SwaggerClient-php/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
8080
Class | Method | HTTP request | Description
8181
------------ | ------------- | ------------- | -------------
8282
*AnotherFakeApi* | [**testSpecialTags**](docs/Api/AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
83-
*DefaultApi* | [**testBodyWithQueryParams**](docs/Api/DefaultApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
8483
*FakeApi* | [**fakeOuterBooleanSerialize**](docs/Api/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
8584
*FakeApi* | [**fakeOuterCompositeSerialize**](docs/Api/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite |
8685
*FakeApi* | [**fakeOuterNumberSerialize**](docs/Api/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
8786
*FakeApi* | [**fakeOuterStringSerialize**](docs/Api/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
87+
*FakeApi* | [**testBodyWithQueryParams**](docs/Api/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
8888
*FakeApi* | [**testClientModel**](docs/Api/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model
8989
*FakeApi* | [**testEndpointParameters**](docs/Api/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
9090
*FakeApi* | [**testEnumParameters**](docs/Api/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters

samples/client/petstore/php/SwaggerClient-php/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"require-dev": {
2626
"phpunit/phpunit": "^4.8",
2727
"squizlabs/php_codesniffer": "~2.6",
28-
"friendsofphp/php-cs-fixer": "~1.12"
28+
"friendsofphp/php-cs-fixer": "~2.12"
2929
},
3030
"autoload": {
3131
"psr-4": { "Swagger\\Client\\" : "lib/" }

samples/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Method | HTTP request | Description
88
[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
99
[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
1010
[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
11+
[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
1112
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
1213
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
1314
[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
@@ -211,6 +212,54 @@ No authorization required
211212

212213
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
213214

215+
# **testBodyWithQueryParams**
216+
> testBodyWithQueryParams($body, $query)
217+
218+
219+
220+
### Example
221+
```php
222+
<?php
223+
require_once(__DIR__ . '/vendor/autoload.php');
224+
225+
$apiInstance = new Swagger\Client\Api\FakeApi(
226+
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
227+
// This is optional, `GuzzleHttp\Client` will be used as default.
228+
new GuzzleHttp\Client()
229+
);
230+
$body = new \Swagger\Client\Model\User(); // \Swagger\Client\Model\User |
231+
$query = "query_example"; // string |
232+
233+
try {
234+
$apiInstance->testBodyWithQueryParams($body, $query);
235+
} catch (Exception $e) {
236+
echo 'Exception when calling FakeApi->testBodyWithQueryParams: ', $e->getMessage(), PHP_EOL;
237+
}
238+
?>
239+
```
240+
241+
### Parameters
242+
243+
Name | Type | Description | Notes
244+
------------- | ------------- | ------------- | -------------
245+
**body** | [**\Swagger\Client\Model\User**](../Model/User.md)| |
246+
**query** | **string**| |
247+
248+
### Return type
249+
250+
void (empty response body)
251+
252+
### Authorization
253+
254+
No authorization required
255+
256+
### HTTP request headers
257+
258+
- **Content-Type**: application/json
259+
- **Accept**: Not defined
260+
261+
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
262+
214263
# **testClientModel**
215264
> \Swagger\Client\Model\Client testClientModel($body)
216265

0 commit comments

Comments
 (0)