-
Notifications
You must be signed in to change notification settings - Fork 38
Refactoring and modernization #18
Refactoring and modernization #18
Conversation
@jeromegamez Sorry for the delay on this! Promise I'll have a review for you within the next 24 hours. |
@jeromegamez Wow, this is great. A big thumbs-up from me. One point of feedback: with the change of the method signatures, this introduces a breaking change for every consumer of the library, and a major version bump. What are your thoughts on adding the original method signature back into the library for backwards compatibility, and it can just call into the new one? We can make the new way the latest-and-greatest, while making the upgrade path seamless. |
Thank you so much for the positive feedback! Re-adding the original method signature is certainly feasible, I will get to it as soon as I can and add it to this PR. |
Uh, there's one thing - the minimum PHP requirement would then impose a problem: PHP 5.2 doesn't support namespaces, so this is a breaking change that would require a major version bump anyways - unless I am overseeing something :/. Without it, an existing PHP 5.2 project would receive the new version through a composer update and get errors because of the namespaces. |
Semantics matter :).
@robertdimarco Your suggestion to re-introduce the legacy generator allowed me to fix some errors that slipped in during the refactoring (especially the wrong I also re-introduced the old test suite, just to make sure that really everything works as expected. You can see the latest Travis CI test results here: https://travis-ci.org/jeromegamez/firebase-token-generator-php/builds/66446660 |
@jeromegamez Perfection, I think that is the right approach, and I'm glad to see that the legacy test suite was reintroduced (and that proved to be useful!). I'll take a look at this later today and see if we can merge + cut a release. |
Again @jeromegamez huge thanks to you and thanks for your patience |
Refactoring and modernization
No, thank you - I couldn't be happier right now! ❤️ |
Following #17, my wish to just modernize the Generator went a little out of control 😊, so here it is.
Notable changes:
Firebase\Token
Services_FirebaseTokenGenerator
is nowFirebase\Token\TokenGenerator
and the usage has been changed (see the updated README for examples)TokenException
which makes it easier to catch them in the projects in which the generator is used.editorconfig
and.php_cs
(see PHP Coding Standards Fixer) file are now present. The settings in here are of course highly opinionated :)I removed some checks from the tests, even the one I introduced myself 😄, because I became aware that these checks should be (and are already) done in the JWT library, not in this token generator.
And finally, here are the test results and code coverage reports:
Your feedback is highly appreciated, and I will happily apply change requests to make this work. I am aware that this is a quite radical change, but people using the current version should not be affected and can continue using a version < 3.0
Cheers!
Jérôme