Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Diagnose command: Add GitHub OAuth token expiration date information
GitHub's new fine-grained tokens have a cumpulsory expiration date, and their classic tokens also support an expiration date. https://github.blog/changelog/2021-07-26-expiration-options-for-personal-access-tokens/ This improves the `composer diagnose` command to display the expiration date and time if it is provided by the response headers (via `GitHub-Authentication-Token-Expiration`). The `DateTime::createFromFormat` call is used to validate the expected date format. It accounts for all the possible issued with the datetime extension by catching `\Throwable` exceptions. This can be fine-tuned in the future by narrowing the catched scopes to `\ValueError`, or the new granualar [exceptions in PHP >= 8.3](https://php.watch/versions/8.3/datetime-exceptions)
- Loading branch information