Skip to content

Commit 00ab97b

Browse files
authored
feature #1144 Fix implicit nullable types to avoid PHP 8.4 warnings (eiriksm, acrobat)
This PR was squashed before being merged into the 3.14-dev branch. Discussion ---------- Commits ------- 9bd8e00 Fix implicit nullable types to avoid PHP 8.4 warnings ad84a65 Fix a param that was not supposed to be nullable a35a829 Update ci.yml 297f04e Fixes with phpcbf 1b63598 Fix implicit nullable case in tests 6d145f5 Fix upstream deprecation warnings
1 parent 71fec50 commit 00ab97b

17 files changed

+32
-26
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
14+
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
1515

1616
steps:
1717
- uses: actions/checkout@v4
@@ -27,6 +27,8 @@ jobs:
2727

2828
- name: Run phpunit
2929
run: vendor/bin/phpunit --verbose
30+
env:
31+
SYMFONY_DEPRECATIONS_HELPER: 'max[self]=0'
3032

3133
phpstan:
3234
name: PHPStan

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
"require-dev": {
3535
"symfony/cache": "^5.1.8",
36-
"guzzlehttp/psr7": "^1.7",
36+
"guzzlehttp/psr7": "^2.7",
3737
"http-interop/http-factory-guzzle": "^1.0",
3838
"guzzlehttp/guzzle": "^7.2",
3939
"php-http/mock-client": "^1.4.1",

lib/Github/Api/Notification.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Notification extends AbstractApi
2727
*
2828
* @return array array of notifications
2929
*/
30-
public function all($includingRead = false, $participating = false, DateTime $since = null, DateTime $before = null)
30+
public function all($includingRead = false, $participating = false, ?DateTime $since = null, ?DateTime $before = null)
3131
{
3232
$parameters = [
3333
'all' => $includingRead,
@@ -54,7 +54,7 @@ public function all($includingRead = false, $participating = false, DateTime $si
5454
*
5555
* @param DateTime|null $since
5656
*/
57-
public function markRead(DateTime $since = null)
57+
public function markRead(?DateTime $since = null)
5858
{
5959
$parameters = [];
6060

lib/Github/Api/Repository/Actions/Workflows.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function usage(string $username, string $repository, $workflow)
7070
*
7171
* @return array|string empty
7272
*/
73-
public function dispatches(string $username, string $repository, $workflow, string $ref, array $inputs = null)
73+
public function dispatches(string $username, string $repository, $workflow, string $ref, ?array $inputs = null)
7474
{
7575
if (is_string($workflow)) {
7676
$workflow = rawurlencode($workflow);

lib/Github/Api/Repository/Contents.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function show($username, $repository, $path = null, $reference = null, $r
9898
*
9999
* @return array information about the new file
100100
*/
101-
public function create($username, $repository, $path, $content, $message, $branch = null, array $committer = null)
101+
public function create($username, $repository, $path, $content, $message, $branch = null, ?array $committer = null)
102102
{
103103
$url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents/'.rawurlencode($path);
104104

@@ -174,7 +174,7 @@ public function exists($username, $repository, $path, $reference = null)
174174
*
175175
* @return array information about the updated file
176176
*/
177-
public function update($username, $repository, $path, $content, $message, $sha, $branch = null, array $committer = null)
177+
public function update($username, $repository, $path, $content, $message, $sha, $branch = null, ?array $committer = null)
178178
{
179179
$url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents/'.rawurlencode($path);
180180

@@ -215,7 +215,7 @@ public function update($username, $repository, $path, $content, $message, $sha,
215215
*
216216
* @return array information about the updated file
217217
*/
218-
public function rm($username, $repository, $path, $message, $sha, $branch = null, array $committer = null)
218+
public function rm($username, $repository, $path, $message, $sha, $branch = null, ?array $committer = null)
219219
{
220220
$url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents/'.rawurlencode($path);
221221

lib/Github/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class Client
123123
* @param string|null $apiVersion
124124
* @param string|null $enterpriseUrl
125125
*/
126-
public function __construct(Builder $httpClientBuilder = null, $apiVersion = null, $enterpriseUrl = null)
126+
public function __construct(?Builder $httpClientBuilder = null, $apiVersion = null, $enterpriseUrl = null)
127127
{
128128
$this->responseHistory = new History();
129129
$this->httpClientBuilder = $builder = $httpClientBuilder ?? new Builder();

lib/Github/Exception/ApiLimitExceedException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ApiLimitExceedException extends RuntimeException
2020
* @param int $code
2121
* @param Throwable|null $previous
2222
*/
23-
public function __construct(int $limit = 5000, int $reset = 1800, int $code = 0, Throwable $previous = null)
23+
public function __construct(int $limit = 5000, int $reset = 1800, int $code = 0, ?Throwable $previous = null)
2424
{
2525
$this->limit = (int) $limit;
2626
$this->reset = (int) $reset;

lib/Github/Exception/MissingArgumentException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class MissingArgumentException extends ErrorException
1414
* @param int $code
1515
* @param Throwable|null $previous
1616
*/
17-
public function __construct($required, int $code = 0, Throwable $previous = null)
17+
public function __construct($required, int $code = 0, ?Throwable $previous = null)
1818
{
1919
if (is_string($required)) {
2020
$required = [$required];

lib/Github/Exception/SsoRequiredException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class SsoRequiredException extends RuntimeException
1414
* @param int $code
1515
* @param Throwable|null $previous
1616
*/
17-
public function __construct(string $url, int $code = 0, Throwable $previous = null)
17+
public function __construct(string $url, int $code = 0, ?Throwable $previous = null)
1818
{
1919
$this->url = $url;
2020

lib/Github/Exception/TwoFactorAuthenticationRequiredException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class TwoFactorAuthenticationRequiredException extends RuntimeException
1414
* @param int $code
1515
* @param Throwable|null $previous
1616
*/
17-
public function __construct(string $type, int $code = 0, Throwable $previous = null)
17+
public function __construct(string $type, int $code = 0, ?Throwable $previous = null)
1818
{
1919
$this->type = $type;
2020
parent::__construct('Two factor authentication is enabled on this account', $code, $previous);

0 commit comments

Comments
 (0)