Skip to content

Clean PHP 8.4 related warnings #502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ jobs:
php:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
steps:
-
name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

-
name: Install PHP
Expand All @@ -33,7 +35,7 @@ jobs:

-
name: Cache dependencies installed with composer
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
Expand Down
2 changes: 1 addition & 1 deletion src/BotApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class BotApi
* @param HttpClientInterface|null $httpClient
* @param string|null $endpoint
*/
public function __construct($token, HttpClientInterface $httpClient = null, $endpoint = null)
public function __construct($token, ?HttpClientInterface $httpClient = null, $endpoint = null)
{
$this->token = $token;
$this->endpoint = ($endpoint ?: self::URL_PREFIX) . $token;
Expand Down
4 changes: 2 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Client
* @param HttpClientInterface|null $httpClient
* @param string|null $endpoint
*/
public function __construct($token, HttpClientInterface $httpClient = null, $endpoint = null)
public function __construct($token, ?HttpClientInterface $httpClient = null, $endpoint = null)
{
$this->api = new BotApi($token, $httpClient, $endpoint);
$this->events = new EventCollection();
Expand Down Expand Up @@ -135,7 +135,7 @@ public function preCheckoutQuery(Closure $action)
*
* @return \TelegramBot\Api\Client
*/
public function on(Closure $event, Closure $checker = null)
public function on(Closure $event, ?Closure $checker = null)
{
$this->events->add($event, $checker);

Expand Down
2 changes: 1 addition & 1 deletion src/Events/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Event
* @param \Closure $action
* @param \Closure|null $checker
*/
public function __construct(\Closure $action, \Closure $checker = null)
public function __construct(\Closure $action, ?\Closure $checker = null)
{
$this->action = $action;
$this->checker = $checker;
Expand Down
4 changes: 2 additions & 2 deletions src/Http/AbstractHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

abstract class AbstractHttpClient implements HttpClientInterface
{
public function request($url, array $data = null)
public function request($url, ?array $data = null)
{
$response = $this->doRequest($url, $data);

Expand All @@ -27,7 +27,7 @@ public function download($url)
* @param array|null $data
* @return array
*/
abstract protected function doRequest($url, array $data = null);
abstract protected function doRequest($url, ?array $data = null);

/**
* @param string $url
Expand Down
2 changes: 1 addition & 1 deletion src/Http/CurlHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function __construct(array $options = [])
/**
* @inheritDoc
*/
protected function doRequest($url, array $data = null)
protected function doRequest($url, ?array $data = null)
{
$options = $this->options + [
CURLOPT_URL => $url,
Expand Down
2 changes: 1 addition & 1 deletion src/Http/HttpClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface HttpClientInterface
* @return mixed
* @throws Exception
*/
public function request($url, array $data = null);
public function request($url, ?array $data = null);

/**
* Get file contents
Expand Down
2 changes: 1 addition & 1 deletion src/Http/PsrHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(
/**
* @inheritDoc
*/
protected function doRequest($url, array $data = null)
protected function doRequest($url, ?array $data = null)
{
if ($data) {
$method = 'POST';
Expand Down
2 changes: 1 addition & 1 deletion src/Http/SymfonyHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(SymfonyHttpClientInterface $http)
/**
* @inheritDoc
*/
protected function doRequest($url, array $data = null)
protected function doRequest($url, ?array $data = null)
{
$options = [];
if ($data) {
Expand Down
Loading