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

Fix all phpdoc annotations when they can be null #789

Closed
ruudk opened this issue Nov 4, 2019 · 8 comments
Closed

Fix all phpdoc annotations when they can be null #789

ruudk opened this issue Nov 4, 2019 · 8 comments
Labels

Comments

@ruudk
Copy link
Contributor

ruudk commented Nov 4, 2019

I'm looking at Card.php:

stripe-php/lib/Card.php

Lines 11 to 18 in b6b8bdd

* @property string $address_city
* @property string $address_country
* @property string $address_line1
* @property string $address_line1_check
* @property string $address_line2
* @property string $address_state
* @property string $address_zip
* @property string $address_zip_check

and I see that all these properties are marked as string type. But when I check the documentation, I see that these properties can be either string or null:
https://stripe.com/docs/api/cards/object
Screenshot 2019-11-04 at 17 32 18

Is there a full list of all properties and the nullability? I think it would be good to fix all these properties as they can lead to bugs.

@ruudk
Copy link
Contributor Author

ruudk commented Nov 4, 2019

Looking at https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.yaml it should be doable to automatically fix all these issues.

@remi-stripe
Copy link
Contributor

@ruudk tagging as future for now. We're working on auto-generating the client library from the openapi spec (we do already for java, ruby, python and node). Once that is shipped we should be able to add the nullability context to the phpdocs.

Tagging @ob-stripe who is working on this.

@ruudk
Copy link
Contributor Author

ruudk commented Nov 4, 2019

Cool, that seems like the way to go indeed! Is there a PR to track the progress or an ETA on this?

@remi-stripe
Copy link
Contributor

No PR or firm ETA just yet no but it's being worked on internally!

@ruudk
Copy link
Contributor Author

ruudk commented Nov 4, 2019

Would it already be possible that I submit a PR to fix some (10-15) of these issues? I'm running https://psalm.dev/ and it complains a lot.

@remi-stripe
Copy link
Contributor

Hmmm that might conflict with our autogen approach so I'd recommend punting for now. But cc @ob-stripe in case you have more context.

@ob-stripe
Copy link
Contributor

Hi @ruudk. Really appreciate the offer, but as @remi-stripe mentioned I think it might conflict with our own efforts. We'll try to release a fix for this soon. Thanks for your patience!

@ob-stripe
Copy link
Contributor

Fixed in v7.8.0 (by #790). All nullable fields should now be marked as such in PHPDoc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants