Skip to content

Commit 2dc1ff9

Browse files
Merge pull request #301 from commercetools/fix-deprecation
Fix deprecation
2 parents 9dbf5ac + 8d31291 commit 2dc1ff9

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ jobs:
9898
- "7.4"
9999
- "8.0"
100100
- "8.1"
101+
- "8.2"
102+
- "8.3"
103+
- "8.4"
101104
dependencies:
102105
- lowest
103106
- highest

lib/commercetools-base/src/Client/ClientCredentials.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ class ClientCredentials
3232
* The client id.
3333
* @param string $clientSecret
3434
* The client secret.
35-
* @param string $scope
35+
* @param ?string $scope
3636
* Provide the scope when you want to request a specific ones for the client.
3737
* Can be omitted to use all scopes of the oauth client.
3838
* Format: `<the scope name>:<the project key>`.
3939
* Example: `manage_products:project1`.
4040
*/
41-
public function __construct(string $clientId, string $clientSecret, string $scope = null)
41+
public function __construct(string $clientId, string $clientSecret, ?string $scope = null)
4242
{
4343
$this->clientId = $clientId;
4444
$this->clientSecret = $clientSecret;
4545
$this->scope = $scope;
46-
$this->cacheKey = sha1($clientId . (string)$scope);
46+
$this->cacheKey = sha1($clientId . $scope);
4747
}
4848

4949
public function getClientId(): string

test/unit/MiscTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
use Commercetools\Api\Models\Type\TypeReferenceBuilder;
3838
use Commercetools\Api\Models\Type\TypeResourceIdentifierBuilder;
3939
use Commercetools\Base\JsonObject;
40+
use Commercetools\Client\ClientCredentials;
4041
use Commercetools\Client\ClientFactory;
4142
use GuzzleHttp\Psr7\Response;
4243
use PHPUnit\Framework\TestCase;
@@ -289,4 +290,11 @@ public function testAddressDraft()
289290
json_encode($cart)
290291
);
291292
}
293+
294+
295+
public function testCredentials()
296+
{
297+
$credentials = new ClientCredentials("clientId", "clientSecret");
298+
$this->assertInstanceOf(ClientCredentials::class, $credentials);
299+
}
292300
}

0 commit comments

Comments
 (0)