Skip to content

Commit

Permalink
feat: add TypedItem to allow for psr/cache:3
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed Mar 24, 2022
1 parent 21dd478 commit 7365613
Show file tree
Hide file tree
Showing 46 changed files with 678 additions and 2,026 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ accept your pull requests.

* Check that the issue has not already been reported.
* Check that the issue has not already been fixed in the latest code
(a.k.a. `master`).
(a.k.a. `main`).
* Be clear, concise and precise in your description of the problem.
* Open an issue with a descriptive title and a summary in grammatically correct,
complete sentences.
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/docs/sami.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

$versions = GitVersionCollection::create($projectRoot)
->addFromTags('v1.*')
->add('master', 'master branch');
->add('main', 'main branch');

return new Sami($iterator, [
'title' => 'Google Auth Library for PHP API Reference',
Expand Down
19 changes: 0 additions & 19 deletions .github/actions/unittest/entrypoint.sh

This file was deleted.

24 changes: 0 additions & 24 deletions .github/actions/unittest/retry.php

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ name: Generate Documentation
on:
push:
branches:
- master
- main
tags:
- "*"

jobs:
docs:
name: "Generate Project Documentation"
runs-on: ubuntu-16.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.3
- name: Install Dependencies
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
Expand Down
91 changes: 16 additions & 75 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,44 @@
name: Test Suite
on:
push:
branches:
- master
branches: [ main ]
pull_request:

jobs:
test:
runs-on: ${{matrix.operating-system}}
runs-on: ubuntu-latest
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php: [ "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0" ]
php: [ "7.1", "7.2", "7.3", "7.4", "8.0", "8.1" ]
name: PHP ${{matrix.php }} Unit Test
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- if: ${{ matrix.php != '8.0' }}
name: Install Dependencies
uses: nick-invision/retry@v1
- name: Install Dependencies
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: composer install
- if: ${{ matrix.php == '8.0' }}
name: Install Dependencies (PHP 8.0)
uses: nick-invision/retry@v1
with:
timeout_minutes: 10
max_attempts: 3
command: |
composer remove --dev --ignore-platform-reqs phpunit/phpunit
composer require --dev --ignore-platform-reqs --update-with-all-dependencies phpunit/phpunit:^7
- name: Run Script
run: vendor/bin/phpunit
test_lowest:
runs-on: ${{matrix.operating-system}}
runs-on: ubuntu-latest
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php: [ "5.6", "7.0", "7.1", "7.2" ]
php: [ "7.1", "7.2" ]
name: PHP ${{matrix.php }} Unit Test Prefer Lowest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Install Dependencies
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
Expand All @@ -62,79 +49,33 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php: [ "5.6", "7.2" ]
php: [ "7.2" ]
name: PHP ${{ matrix.php }} Unit Test Guzzle 6
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Install Dependencies
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: composer require guzzlehttp/guzzle:^6 && composer update
- name: Run Script
run: vendor/bin/phpunit
# use dockerfiles for oooooolllllldddd versions of php, setup-php times out for those.
test_php55:
name: "PHP 5.5 Unit Test"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run Unit Tests
uses: docker://php:5.5-cli
with:
entrypoint: ./.github/actions/unittest/entrypoint.sh
test_php55_lowest:
name: "PHP 5.5 Unit Test Prefer Lowest"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run Unit Tests
uses: docker://php:5.5-cli
env:
composerargs: "--prefer-lowest"
with:
entrypoint: ./.github/actions/unittest/entrypoint.sh
test_php54:
name: "PHP 5.4 Unit Test"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run Unit Tests
uses: docker://php:5.4-cli
with:
entrypoint: ./.github/actions/unittest/entrypoint.sh
test_php54_lowest:
name: "PHP 5.4 Unit Test Prefer Lowest"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run Unit Tests
uses: docker://php:5.4-cli
env:
composerargs: "--prefer-lowest"
with:
entrypoint: ./.github/actions/unittest/entrypoint.sh
style:
runs-on: ubuntu-latest
name: PHP Style Check
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
php-version: "8.0"
- name: Install Dependencies
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
## 1.11.1 (7/27/2020)

* [fix]: catch ConnectException in GCE check (#294)
* [docs]: Adds [reference docs](https://googleapis.github.io/google-auth-library-php/master)
* [docs]: Adds [reference docs](https://googleapis.github.io/google-auth-library-php/main)

## 1.11.0 (7/22/2020)

Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<dl>
<dt>Homepage</dt><dd><a href="http://www.github.com/google/google-auth-library-php">http://www.github.com/google/google-auth-library-php</a></dd>
<dt>Reference Docs</dt><dd><a href="https://googleapis.github.io/google-auth-library-php/master/">https://googleapis.github.io/google-auth-library-php/master/</a></dd>
<dt>Reference Docs</dt><dd><a href="https://googleapis.github.io/google-auth-library-php/main/">https://googleapis.github.io/google-auth-library-php/main/</a></dd>
<dt>Authors</dt>
<dd><a href="mailto:[email protected]">Tim Emiola</a></dd>
<dd><a href="mailto:[email protected]">Stanley Cheung</a></dd>
Expand Down Expand Up @@ -175,7 +175,7 @@ used when you set up your protected resource as the target audience. See how to
#### Call using a specific JSON key
If you want to use a specific JSON key instead of using `GOOGLE_APPLICATION_CREDENTIALS` environment variable, you can
do this:

```php
use Google\Auth\CredentialsLoader;
use Google\Auth\Middleware\AuthTokenMiddleware;
Expand Down Expand Up @@ -216,10 +216,10 @@ print_r((string) $response->getBody());

#### Call using Proxy-Authorization Header
If your application is behind a proxy such as [Google Cloud IAP][iap-proxy-header],
and your application occupies the `Authorization` request header,
you can include the ID token in a `Proxy-Authorization: Bearer`
header instead. If a valid ID token is found in a `Proxy-Authorization` header,
IAP authorizes the request with it. After authorizing the request, IAP passes
and your application occupies the `Authorization` request header,
you can include the ID token in a `Proxy-Authorization: Bearer`
header instead. If a valid ID token is found in a `Proxy-Authorization` header,
IAP authorizes the request with it. After authorizing the request, IAP passes
the Authorization header to your application without processing the content.
For this, use the static method `getProxyIdTokenMiddleware` on
`ApplicationDefaultCredentials`.
Expand Down Expand Up @@ -305,8 +305,8 @@ about the client or APIs on [StackOverflow](http://stackoverflow.com).

[google-apis-php-client]: https://github.com/google/google-api-php-client
[application default credentials]: https://developers.google.com/accounts/docs/application-default-credentials
[contributing]: https://github.com/google/google-auth-library-php/tree/master/.github/CONTRIBUTING.md
[copying]: https://github.com/google/google-auth-library-php/tree/master/COPYING
[contributing]: https://github.com/google/google-auth-library-php/tree/main/.github/CONTRIBUTING.md
[copying]: https://github.com/google/google-auth-library-php/tree/main/COPYING
[Guzzle]: https://github.com/guzzle/guzzle
[Guzzle 5]: http://docs.guzzlephp.org/en/5.3
[developer console]: https://console.developers.google.com
14 changes: 8 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@
"homepage": "http://github.com/google/google-auth-library-php",
"license": "Apache-2.0",
"support": {
"docs": "https://googleapis.github.io/google-auth-library-php/master/"
"docs": "https://googleapis.github.io/google-auth-library-php/main/"
},
"require": {
"php": ">=5.4",
"firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0",
"guzzlehttp/guzzle": "^5.3.1|^6.2.1|^7.0",
"php": "^7.1||^8.0",
"firebase/php-jwt": "~5.0",
"guzzlehttp/guzzle": "^6.2.1|^7.0",
"guzzlehttp/psr7": "^1.7|^2.0",
"psr/http-message": "^1.0",
"psr/cache": "^1.0|^2.0"
"psr/cache": "^1.0|^2.0|^3.0"
},
"require-dev": {
"guzzlehttp/promises": "0.1.1|^1.3",
"phpunit/phpunit": "^4.8.36|^5.7",
"squizlabs/php_codesniffer": "^3.5",
"phpunit/phpunit": "^7.5||^8.5",
"phpspec/prophecy-phpunit": "^1.1",
"sebastian/comparator": ">=1.2.3",
"phpseclib/phpseclib": "^2.0.31",
"kelvinmo/simplejwt": "^0.2.5|^0.5.1"
Expand Down
4 changes: 1 addition & 3 deletions src/AccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,7 @@ private function setPhpsecConstants()
*/
protected function callJwtStatic($method, array $args = [])
{
$class = class_exists('Firebase\JWT\JWT')
? 'Firebase\JWT\JWT'
: 'JWT';
$class = 'Firebase\JWT\JWT';
return call_user_func_array([$class, $method], $args);
}

Expand Down
7 changes: 0 additions & 7 deletions src/Cache/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,10 @@ private function isValidExpiration($expiration)
return true;
}

// We test for two types here due to the fact the DateTimeInterface
// was not introduced until PHP 5.5. Checking for the DateTime type as
// well allows us to support 5.4.
if ($expiration instanceof \DateTimeInterface) {
return true;
}

if ($expiration instanceof \DateTime) {
return true;
}

return false;
}

Expand Down
Loading

0 comments on commit 7365613

Please sign in to comment.