Skip to content

fix deprecation error on PHP 8.4 #17

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
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
8 changes: 4 additions & 4 deletions src/Client.php
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t you just be adding ?array

Copy link
Author

@tenzap tenzap Feb 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC doing how I did permits to keep compatibility with PHP 5.6 & 7.0 (the syntax you suggest is valid since 7.1 only)

Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function reset()
* @return self
* Returns the object handle (so you can chain method calls, if you like)
*/
public function query($id, string $method, array $arguments = null): self
public function query($id, string $method, $arguments = null): self
{
$request = self::getRequest($method, $arguments);
$request['id'] = $id;
Expand All @@ -80,7 +80,7 @@ public function query($id, string $method, array $arguments = null): self
* @return self
* Returns the object handle (so you can chain method calls, if you like)
*/
public function notify($method, array $arguments = null): self
public function notify($method, $arguments = null): self
{
$request = self::getRequest($method, $arguments);

Expand Down Expand Up @@ -209,7 +209,7 @@ public function postDecode($input)
return $responses;
}

private static function getRequest(string $method, array $arguments = null): array
private static function getRequest(string $method, $arguments = null): array
{
$request = [
'jsonrpc' => self::VERSION,
Expand Down Expand Up @@ -238,7 +238,7 @@ private static function getValueText($value): string
return var_export($value, true);
}

private function getResponses($input, array &$responses = null): bool
private function getResponses($input, &$responses = null): bool
{
if ($this->getResponse($input, $response)) {
$responses = [$response];
Expand Down