Skip to content

Commit d9fcf48

Browse files
Fix: Deprecation warning in PHP 8.4 (#416)
* Fixed deprecation warning in PHP 8.4 about implicitly marking a parameter as null instead of typing it explicitly * Fixed a few more deprecation warnings in PHP 8.4
1 parent 42e7e2c commit d9fcf48

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Contracts/ApiHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ interface ApiHelper
2424
*
2525
* @return self
2626
*/
27-
public function make(Session $session = null);
27+
public function make(?Session $session = null);
2828

2929
/**
3030
* Set an existing API instance.

src/Services/ApiHelper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ApiHelper implements IApiHelper
3939
/**
4040
* {@inheritdoc}
4141
*/
42-
public function make(Session $session = null): self
42+
public function make(?Session $session = null): self
4343
{
4444
// Create the options
4545
$opts = new Options();
@@ -517,7 +517,7 @@ protected function chargeApiPath(ChargeType $chargeType): string
517517
*
518518
* @return array
519519
*/
520-
protected function doRequest(ApiMethod $method, string $path, array $payload = null)
520+
protected function doRequest(ApiMethod $method, string $path, ?array $payload = null)
521521
{
522522
$response = $this->api->rest($method->toNative(), $path, $payload);
523523
if ($response['errors'] === true) {
@@ -563,7 +563,7 @@ protected function doRequestGraphQL(string $query, array $payload = []): array
563563
*
564564
* @return NullableShopDomain
565565
*/
566-
private function getShopDomain(Session $session = null): NullableShopDomain
566+
private function getShopDomain(?Session $session = null): NullableShopDomain
567567
{
568568
// Check for existing session passed in
569569
if ($session && $session->getShop()) {

src/Util.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static function createHmac(array $opts, string $secret): Hmac
6565
*
6666
* @return mixed
6767
*/
68-
public static function parseQueryString(string $queryString, string $delimiter = null): array
68+
public static function parseQueryString(string $queryString, ?string $delimiter = null): array
6969
{
7070
$commonSeparator = [';' => '/[;]\s*/', ';,' => '/[;,]\s*/', '&' => '/[&]\s*/'];
7171
$defaultSeparator = '/[&;]\s*/';

0 commit comments

Comments
 (0)