Skip to content

[PHP] fixed ApiException's methods return types #4845

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

Merged
merged 1 commit into from
Mar 2, 2017
Merged

[PHP] fixed ApiException's methods return types #4845

merged 1 commit into from
Mar 2, 2017

Conversation

baartosz
Copy link
Contributor

@baartosz baartosz commented Feb 23, 2017

PR checklist

  • Read the contribution guildelines.
  • Ran the shell/batch script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates)
  • Filed the PR against the correct branch: master for non-breaking changes and 2.3.0 branch for breaking (non-backward compatible) changes.

Description of the PR

Hi. This PR fixes minor errors in test.php file which where caused by different types returned than expected. Preview:

/usr/bin/php /home/bbialek/projects/swagger-codegen/samples/client/petstore/php/test.php
PHP SDK (Swagger\Client) Debug Report:
    OS: Linux bbialek-HP-EliteDesk-800-G1-SFF 4.4.0-62-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64
    PHP Version: 7.0.13-0ubuntu0.16.04.1
    OpenAPI Spec Version: 1.0.0
    Temp Folder Path: /tmp
PHP Notice:  Array to string conversion in /home/bbialek/projects/swagger-codegen/samples/client/petstore/php/test.php on line 58
PHP Stack trace:
PHP   1. {main}() /home/bbialek/projects/swagger-codegen/samples/client/petstore/php/test.php:0
PHP Catchable fatal error:  Object of class stdClass could not be converted to string in /home/bbialek/projects/swagger-codegen/samples/client/petstore/php/test.php on line 59
PHP Stack trace:
PHP   1. {main}() /home/bbialek/projects/swagger-codegen/samples/client/petstore/php/test.php:0
Caught exception: [404] Error connecting to the API (http://petstore.swagger.io/v2/pet/10005)
HTTP response headers: Array
HTTP response body: 
Process finished with exit code 255

After fix:

/usr/bin/php /home/bbialek/projects/swagger-codegen/samples/client/petstore/php/test.php
PHP SDK (Swagger\Client) Debug Report:
    OS: Linux bbialek-HP-EliteDesk-800-G1-SFF 4.4.0-62-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64
    PHP Version: 7.0.13-0ubuntu0.16.04.1
    OpenAPI Spec Version: 1.0.0
    Temp Folder Path: /tmp
Caught exception: [404] Error connecting to the API (http://petstore.swagger.io/v2/pet/10005)
HTTP response headers: Array
(
    [0] => HTTP/1.1 404 Not Found
    [Date] => Thu, 23 Feb 2017 09:38:59 GMT
    [Access-Control-Allow-Origin] => *
    [Access-Control-Allow-Methods] => GET, POST, DELETE, PUT
    [Access-Control-Allow-Headers] => Content-Type, api_key, Authorization
    [Content-Type] => application/json
    [Connection] => close
    [Server] => Jetty(9.2.9.v20150224)
)

HTTP response body: stdClass Object
(
    [code] => 1
    [type] => error
    [message] => Pet not found
)

HTTP status code: 404

Process finished with exit code 0

I also updated return types in ApiException template to match what is really passed there in generated ApiClient class: https://github.com/swagger-api/swagger-codegen/blob/master/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php#L283

@baartosz baartosz changed the title fixed ApiException's methods return types [PHPfixed ApiException's methods return types Feb 23, 2017
@baartosz baartosz changed the title [PHPfixed ApiException's methods return types [PHP] fixed ApiException's methods return types Feb 23, 2017
@wing328
Copy link
Contributor

wing328 commented Feb 23, 2017

Thanks for the PR but your commit (as shown in the Commits tab) is not linked to your Github account, which means this PR won't count as your contribution in https://github.com/swagger-api/swagger-codegen/graphs/contributors.

Let me know if you need help fixing it.

Ref: https://github.com/swagger-api/swagger-codegen/wiki/FAQ#how-can-i-update-commits-that-are-not-linked-to-my-github-account

Copy link
Contributor

@arnested arnested left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@wing328
Copy link
Contributor

wing328 commented Mar 2, 2017

@arnested thanks for reviewing the change.

@baartosz thanks for your contribution, which has been merged into master (2.2.3)

@wing328 wing328 merged commit 26257da into swagger-api:master Mar 2, 2017
spr3nk3ls pushed a commit to spr3nk3ls/swagger-codegen that referenced this pull request Mar 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants