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

bugfix: update deprecated command methods #2938

Merged
merged 1 commit into from
Jun 6, 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
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