Skip to content
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

fix: php 8.4 deprecations #226

Merged
merged 1 commit into from
Aug 27, 2024
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Deprecated
### Removed
### Fixed
- Fixed upcomming PHP 8.4 deprecations
### Updated APIs
- Updated opensearch-php APIs to reflect [opensearch-api-specification@cb320b5](https://github.com/opensearch-project/opensearch-api-specification/commit/cb320b5482551c4f28afa26ff0d1653332699722)
### Security
Expand Down
4 changes: 2 additions & 2 deletions src/OpenSearch/ClientBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@
* @param string $cert The name of a file containing a PEM formatted certificate.
* @param string $password if the certificate requires a password
*/
public function setSSLCert(string $cert, string $password = null): ClientBuilder
public function setSSLCert(string $cert, ?string $password = null): ClientBuilder

Check warning on line 534 in src/OpenSearch/ClientBuilder.php

View check run for this annotation

Codecov / codecov/patch

src/OpenSearch/ClientBuilder.php#L534

Added line #L534 was not covered by tests
{
$this->sslCert = [$cert, $password];

Expand All @@ -544,7 +544,7 @@
* @param string $key The name of a file containing a private SSL key
* @param string $password if the private key requires a password
*/
public function setSSLKey(string $key, string $password = null): ClientBuilder
public function setSSLKey(string $key, ?string $password = null): ClientBuilder

Check warning on line 547 in src/OpenSearch/ClientBuilder.php

View check run for this annotation

Codecov / codecov/patch

src/OpenSearch/ClientBuilder.php#L547

Added line #L547 was not covered by tests
{
$this->sslKey = [$key, $password];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class JsonErrorException extends \Exception implements OpenSearchException
* @param mixed $input
* @param mixed $result
*/
public function __construct(int $code, $input, $result, \Throwable $previous = null)
public function __construct(int $code, $input, $result, ?\Throwable $previous = null)
{
if (isset(self::$messages[$code]) !== true) {
throw new \InvalidArgumentException(sprintf('Encountered unknown JSON error code: [%d]', $code));
Expand Down
4 changes: 2 additions & 2 deletions src/OpenSearch/Connections/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function __construct(
* @param Transport|null $transport
* @return mixed
*/
public function performRequest(string $method, string $uri, ?array $params = [], $body = null, array $options = [], Transport $transport = null)
public function performRequest(string $method, string $uri, ?array $params = [], $body = null, array $options = [], ?Transport $transport = null)
{
if ($body !== null) {
$body = $this->serializer->serialize($body);
Expand Down Expand Up @@ -256,7 +256,7 @@ public function getLastRequestInfo(): array

private function wrapHandler(callable $handler): callable
{
return function (array $request, Connection $connection, Transport $transport = null, $options) use ($handler) {
return function (array $request, Connection $connection, ?Transport $transport, $options) use ($handler) {
$this->lastRequest = [];
$this->lastRequest['request'] = $request;

Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Connections/ConnectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ public function getLastRequestInfo(): array;
* @param mixed $body
* @return mixed
*/
public function performRequest(string $method, string $uri, ?array $params = [], $body = null, array $options = [], Transport $transport = null);
public function performRequest(string $method, string $uri, ?array $params = [], $body = null, array $options = [], ?Transport $transport = null);
}
4 changes: 2 additions & 2 deletions src/OpenSearch/Handlers/SigV4Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class SigV4Handler
public function __construct(
string $region,
string $service,
callable $credentialProvider = null,
callable $wrappedHandler = null
?callable $credentialProvider = null,
?callable $wrappedHandler = null
) {
self::assertDependenciesInstalled();
$this->signer = new SignatureV4($service, $region);
Expand Down
Loading