Skip to content

Commit 074eba8

Browse files
Clean PHP 8.4 related warnings (#502)
- Implicitly marking parameter as nullable is deprecated, the explicit nullable type must be used instead
1 parent fee1655 commit 074eba8

File tree

9 files changed

+14
-12
lines changed

9 files changed

+14
-12
lines changed

.github/workflows/tests.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ jobs:
1515
php:
1616
- "8.1"
1717
- "8.2"
18+
- "8.3"
19+
- "8.4"
1820
steps:
1921
-
2022
name: Checkout
21-
uses: actions/checkout@v2
23+
uses: actions/checkout@v4
2224

2325
-
2426
name: Install PHP
@@ -33,7 +35,7 @@ jobs:
3335

3436
-
3537
name: Cache dependencies installed with composer
36-
uses: actions/cache@v2
38+
uses: actions/cache@v4
3739
with:
3840
path: ${{ env.COMPOSER_CACHE_DIR }}
3941
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}

src/BotApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class BotApi
177177
* @param HttpClientInterface|null $httpClient
178178
* @param string|null $endpoint
179179
*/
180-
public function __construct($token, HttpClientInterface $httpClient = null, $endpoint = null)
180+
public function __construct($token, ?HttpClientInterface $httpClient = null, $endpoint = null)
181181
{
182182
$this->token = $token;
183183
$this->endpoint = ($endpoint ?: self::URL_PREFIX) . $token;

src/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Client
4343
* @param HttpClientInterface|null $httpClient
4444
* @param string|null $endpoint
4545
*/
46-
public function __construct($token, HttpClientInterface $httpClient = null, $endpoint = null)
46+
public function __construct($token, ?HttpClientInterface $httpClient = null, $endpoint = null)
4747
{
4848
$this->api = new BotApi($token, $httpClient, $endpoint);
4949
$this->events = new EventCollection();
@@ -135,7 +135,7 @@ public function preCheckoutQuery(Closure $action)
135135
*
136136
* @return \TelegramBot\Api\Client
137137
*/
138-
public function on(Closure $event, Closure $checker = null)
138+
public function on(Closure $event, ?Closure $checker = null)
139139
{
140140
$this->events->add($event, $checker);
141141

src/Events/Event.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Event
2222
* @param \Closure $action
2323
* @param \Closure|null $checker
2424
*/
25-
public function __construct(\Closure $action, \Closure $checker = null)
25+
public function __construct(\Closure $action, ?\Closure $checker = null)
2626
{
2727
$this->action = $action;
2828
$this->checker = $checker;

src/Http/AbstractHttpClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
abstract class AbstractHttpClient implements HttpClientInterface
88
{
9-
public function request($url, array $data = null)
9+
public function request($url, ?array $data = null)
1010
{
1111
$response = $this->doRequest($url, $data);
1212

@@ -27,7 +27,7 @@ public function download($url)
2727
* @param array|null $data
2828
* @return array
2929
*/
30-
abstract protected function doRequest($url, array $data = null);
30+
abstract protected function doRequest($url, ?array $data = null);
3131

3232
/**
3333
* @param string $url

src/Http/CurlHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function __construct(array $options = [])
110110
/**
111111
* @inheritDoc
112112
*/
113-
protected function doRequest($url, array $data = null)
113+
protected function doRequest($url, ?array $data = null)
114114
{
115115
$options = $this->options + [
116116
CURLOPT_URL => $url,

src/Http/HttpClientInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface HttpClientInterface
1515
* @return mixed
1616
* @throws Exception
1717
*/
18-
public function request($url, array $data = null);
18+
public function request($url, ?array $data = null);
1919

2020
/**
2121
* Get file contents

src/Http/PsrHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(
4040
/**
4141
* @inheritDoc
4242
*/
43-
protected function doRequest($url, array $data = null)
43+
protected function doRequest($url, ?array $data = null)
4444
{
4545
if ($data) {
4646
$method = 'POST';

src/Http/SymfonyHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct(SymfonyHttpClientInterface $http)
2424
/**
2525
* @inheritDoc
2626
*/
27-
protected function doRequest($url, array $data = null)
27+
protected function doRequest($url, ?array $data = null)
2828
{
2929
$options = [];
3030
if ($data) {

0 commit comments

Comments
 (0)