8000 Merge branch 'release/1.0.6' · sunaoka/push-notifications-php@df7052f · GitHub
[go: up one dir, main page]

Skip to content

Commit df7052f

Browse files
committed
Merge branch 'release/1.0.6'
2 parents 8c8c455 + 2b95b16 commit df7052f

File tree

16 files changed

+95
-36
lines changed

16 files changed

+95
-36
lines changed

.github/workflows/stale.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# https://docs.github.com/actions/managing-issues-and-pull-requests/closing-inactive-issues
2+
name: Close inactive issues
3+
on:
4+
schedule:
5+
- cron: "0 1 * * *"
6+
7+
jobs:
8+
close-issues:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
issues: write
12+
pull-requests: write
13+
steps:
14+
- uses: actions/stale@v7
15+
with:
16+
days-before-issue-stale: 30
17+
days-before-issue-close: 14
18+
stale-issue-label: "stale"
19+
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
20+
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
21+
days-before-pr-stale: -1
22+
days-before-pr-close: -1
23+
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ jobs:
1616
php: [
1717
'5.5', '5.6',
1818
'7.0', '7.1', '7.2', '7.3', '7.4',
19-
'8.0', '8.1', '8.2'
19+
'8.0', '8.1', '8.2', '8.3'
2020
]
2121

2222
name: PHP ${{ matrix.php }}
2323

2424
steps:
25-
- name: Setup PHP ${{ matrix.php-version }}
25+
- name: Setup PHP ${{ matrix.php }}
2626
uses: shivammathur/setup-php@v2
2727
with:
2828
php-version: ${{ matrix.php }}
2929

3030
- name: Checkout
31-
uses: actions/checkout@v3
31+
uses: actions/checkout@v4
3232

3333
- name: Install dependencies
34-
run: composer install --quiet --no-ansi --prefer-dist --no-progress --no-interaction
34+
run: composer install --no-ansi --prefer-dist --no-progress --no-interaction
3535

3636
- name: Migrate phpunit XML configuration
3737
continue-on-error: true
@@ -41,7 +41,7 @@ jobs:
4141
run: vendor/bin/phpunit --coverage-clover=coverage.xml
4242

4343
- name: Upload coverage to Codecov
44-
uses: codecov/codecov-action@v3
44+
uses: codecov/codecov-action@v4
4545
with:
4646
token: ${{ secrets.CODECOV_TOKEN }}
4747
files: ./coverage.xml

CHANGELOG.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
# Release Notes
22

3-
## [Unreleased](https://github.com/sunaoka/push-notifications-php/compare/1.0.3...develop)
3+
## [Unreleased](https://github.com/sunaoka/push-notifications-php/compare/1.0.5...develop)
4+
5+
### Changed
6+
7+
- Support PHPUnit 11.x
8+
- Deprecated FCM HTTP legacy APIs
9+
- Because the FCM HTTP legacy APIs was deprecated on June 20, 2023, and will be removed in June 2024.
10+
11+
## [v1.0.5 (2023-02-08)](https://github.com/sunaoka/push-notifications-php/compare/1.0.4...1.0.5)
12+
13+
### Added
14+
15+
- Support PHPUnit 10.x
16+
17+
## [v1.0.4 (2022-12-09)](https://github.com/sunaoka/push-notifications-php/compare/1.0.3...1.0.4)
18+
19+
### Added
20+
21+
- Support PHP 8.2
422

523
## [v1.0.3 (2021-10-14)](https://github.com/sunaoka/push-notifications-php/compare/1.0.2...1.0.3)
624

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Norifumi SUNAOKA
3+
Copyright (c) 2021-2024 Norifumi SUNAOKA
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
1010

1111
## Supported Protocols
1212

13-
| Protocol | Supported | Driver | Options |
14-
| -------------------------- | :-------: | ------------------ | ------------------------- |
15-
| APNs ([Token Based]) | ✓ | `APNs\Token` | `APNs\Token\Option` |
16-
| APNs ([Certificate Based]) | ✓ | `APNs\Certificate` | `APNs\Certificate\Option` |
17-
| APNs ([Binary Provider]) | | | |
18-
| FCM ([HTTP v1]) | ✓ | `FCM\V1` | `FCM\V1\Option` |
19-
| FCM ([Legacy JSON]) | ✓ | `FCM\Json` | `FCM\Json\Option` |
20-
| FCM ([Legacy Plain Text]) | ✓ | `FCM\PlainText` | `FCM\PlainText\Option` |
21-
| FCM ([XMPP]) | | | |
13+
| Protocol | Supported | Driver | Options |
14+
| -------------------------- | :--------: | ------------------ | ------------------------- |
15+
| APNs ([Token Based]) | ✓ | `APNs\Token` | `APNs\Token\Option` |
16+
| APNs ([Certificate Based]) | ✓ | `APNs\Certificate` | `APNs\Certificate\Option` |
17+
| APNs ([Binary Provider]) | | | |
18+
| FCM ([HTTP v1]) | ✓ | `FCM\V1` | `FCM\V1\Option` |
19+
| FCM ([Legacy JSON]) | Deprecated | `FCM\Json` | `FCM\Json\Option` |
20+
| FCM ([Legacy Plain Text]) | Deprecated | `FCM\PlainText` | `FCM\PlainText\Option` |
21+
| FCM ([XMPP]) | | | |
2222

2323
## Installation
2424

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
"vlucas/valitron": "^1.4"
1919
},
2020
"require-dev": {
21-
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0",
22-
"roave/security-advisories": "dev-latest"
21+
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0"
2322
},
2423
"autoload": {
2524
"psr-4": {

phpstan.neon

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,20 @@ parameters:
33
paths:
44
- src
55

6-
level: 7
6+
level: 9
77

88
checkMissingIterableValueType: false
99

1010
ignoreErrors:
11-
-
12-
message: '!Parameter #3 \$private_key of function openssl_sign expects!'
13-
path: src/Drivers/APNs/Token.php
14-
-
15-
message: '!Parameter #1 \$string of function base64_encode expects string,!'
16-
path: src/Drivers/APNs/Token.php
1711
-
1812
message: '!Property Sunaoka\\PushNotifications\\Drivers\\FCM\\V1::\$httpClient!'
1913
path: src/Drivers/FCM/V1.php
2014
-
2115
message: '!Parameter #1 \$errors of class!'
2216
path: src/Drivers/DriverOption.php
23-
# -
24-
# message: '!Else branch is unreachable because previous condition is always true!'
25-
# path: src/Drivers/Driver.php
17+
-
18+
message: '!Else branch is unreachable because previous condition is always true!'
19+
path: src/Drivers/Driver.php
20+
-
21+
message: "!Offset 'class' does not exist on array{function: string, line\\?: int, file\\?: string, class\\?: class-string, type\\?: '->'\\|'::', args\\?: array, object\\?: object}!"
22+
path: src/Exceptions/OptionTypeError.php

src/Drivers/APNs/Certificate.php

Lines changed: 2 additions & 0 deletions
433
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,13 @@ private function _send($device)
8989
$this->feedback->addSuccess($device, $apnsId);
9090

9191
return;
92+
9293
} catch (Exception $e) {
9394
$error = $this->parseErrorResponse($e);
9495
}
9596

9697
if (isset($error['contents'])) {
98+
/** @var array $json */
9799
$json = json_decode($error['contents'], true);
98100
$this->feedback->addFailure($device, $json['reason']);
99101
} else {

src/Drivers/APNs/Token.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,13 @@ private function _send($device)
9191
$this->feedback->addSuccess($device, $apnsId);
9292

9393
return;
94+
9495
} catch (Exception $e) {
9596
$error = $this->parseErrorResponse($e);
9697
}
9798

9899
if (isset($error['contents'])) {
100+
/** @var array $json */
99101
$json = json_decode($error['contents'], true);
100102
$this->feedback->addFailure($device, $json['reason']);
101103
} else {
@@ -118,16 +120,16 @@ private function bearerToken($authKey, $keyId, $teamId)
118120

119121
$key = openssl_pkey_get_private($authKey);
120122
if ($key === false) {
121-
throw new RuntimeException(openssl_error_string()); // @codeCoverageIgnore
123+
throw new RuntimeException((string) openssl_error_string()); // @codeCoverageIgnore
122124
}
123125

124126
$segments = [];
125-
$segments[] = $this->encodeB64URLSafe(json_encode(['alg' => 'ES256', 'kid' => $keyId]));
126-
$segments[] = $this->encodeB64URLSafe(json_encode(['iss' => $teamId, 'iat' => time()]));
127+
$segments[] = $this->encodeB64URLSafe((string) json_encode(['alg' => 'ES256', 'kid' => $keyId]));
128+
$segments[] = $this->encodeB64URLSafe((string) json_encode(['iss' => $teamId, 'iat' => time()]));
127129

128130
$success = openssl_sign(implode('.', $segments), $signature, $key, 'sha256');
129131
if ($success === false) {
130-
throw new RuntimeException(openssl_error_string()); // @codeCoverageIgnore
132+
throw new RuntimeException((string) openssl_error_string()); // @codeCoverageIgnore
131133
}
132134

133135
$segments[] = $this->encodeB64URLSafe($signature);

src/Drivers/Driver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ protected function getEndpoint($replace = '')
116116
/**
117117
* @param Exception $e
118118
*
119-
* @return array{message: ?string, contents: ?string}
119+
* @return array{message: string, contents: ?string}
120120
*/
121121
protected function parseErrorResponse($e)
122122
{

0 commit comments

Comments
 (0)
0