Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Changed JWT::encode and JWT::jsonEncode so that they now accepts an object as well as an array as their first argument
c6d5305 to
c48bd73
Compare
bshaffer
left a comment
There was a problem hiding this comment.
This looks great but it's missing a few tests - would you be able to write some? They could be very simple / copied over from https://github.com/firebase/php-jwt/blob/main/tests/JWTTest.php
|
I have added a single test that just uses an object payload instead of array. |
Changed JWT::encode and JWT::jsonEncode so that they now accept an object as well as an array as their first argument.
As the result of JWT::decode is an object it only makes sense that the same object can be encoded again.
This also makes the use case of using JWT as a session manager more straight forward as you can just encode and decode the user object directly without array conversions.