Skip to content

Commit

Permalink
fix: php 8.4 deprecations (#226)
Browse files Browse the repository at this point in the history
Signed-off-by: Soner Sayakci <s.sayakci@gmail.com>
  • Loading branch information
shyim authored Aug 27, 2024
1 parent b250383 commit 1866e6e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,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 @@ public function setSniffOnStart(bool $sniffOnStart): ClientBuilder
* @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
{
$this->sslCert = [$cert, $password];

Expand All @@ -544,7 +544,7 @@ public function setSSLCert(string $cert, string $password = null): ClientBuilder
* @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
{
$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

0 comments on commit 1866e6e

Please sign in to comment.