Skip to content

Commit

Permalink
bugfix: update deprecated command methods (#2938)
Browse files Browse the repository at this point in the history
  • Loading branch information
stobrien89 authored Jun 6, 2024
1 parent 3e1cc8f commit af1f00d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .changes/nextrelease/multi-auth-update.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"type": "bugfix",
"category": "",
"description": "Updates error level on deprecated `Command` methods. Removes suppressed call to deprecated method."
}
]
4 changes: 2 additions & 2 deletions src/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function setAuthSchemes(array $authSchemes)
trigger_error(__METHOD__ . ' is deprecated. Auth schemes '
. 'resolved using the service `auth` trait or via endpoint resolution '
. 'are now set in the command `@context` property.`'
, E_USER_DEPRECATED
, E_USER_WARNING
);

$this->authSchemes = $authSchemes;
Expand All @@ -99,7 +99,7 @@ public function getAuthSchemes()
trigger_error(__METHOD__ . ' is deprecated. Auth schemes '
. 'resolved using the service `auth` trait or via endpoint resolution '
. 'can now be found in the command `@context` property.`'
, E_USER_DEPRECATED
, E_USER_WARNING
);

return $this->authSchemes ?: [];
Expand Down
1 change: 0 additions & 1 deletion src/EndpointV2/EndpointV2Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ private function applyAuthScheme(
): void
{
$authScheme = $this->resolveAuthScheme($authSchemes);
@$command->setAuthSchemes($authScheme);

$command['@context']['signature_version'] = $authScheme['version'];

Expand Down
12 changes: 6 additions & 6 deletions tests/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ public function testCanAccessLikeArray()
$this->assertNull($c['boo']);
}

public function testGetAuthSchemesEmitsDeprecationNotice()
public function testGetAuthSchemesEmitsWarning()
{
$this->expectDeprecation(E_USER_DEPRECATED);
$this->expectDeprecationMessage(
$this->expectWarning();
$this->expectWarningMessage(
'Aws\Command::getAuthSchemes is deprecated. Auth schemes resolved using the service'
.' `auth` trait or via endpoint resolution can now be found in the command `@context` property.'
);
Expand All @@ -98,10 +98,10 @@ public function testGetAuthSchemesEmitsDeprecationNotice()
$c->getAuthSchemes();
}

public function testSetAuthSchemesEmitsDeprecationNotice()
public function testSetAuthSchemesEmitsWarning()
{
$this->expectDeprecation(E_USER_DEPRECATED);
$this->expectDeprecationMessage(
$this->expectWarning();
$this->expectWarningMessage(
'Aws\Command::setAuthSchemes is deprecated. Auth schemes resolved using the service'
.' `auth` trait or via endpoint resolution are now set in the command `@context` property.'
);
Expand Down

0 comments on commit af1f00d

Please sign in to comment.