From e853ad27a063f9df72d4b9dfaef446afd407ece8 Mon Sep 17 00:00:00 2001 From: Sean O'Brien Date: Thu, 6 Jun 2024 12:50:44 -0400 Subject: [PATCH] bugfix: update deprecated command methods --- .changes/nextrelease/multi-auth-update.json | 7 +++++++ src/Command.php | 4 ++-- src/EndpointV2/EndpointV2Middleware.php | 1 - tests/CommandTest.php | 12 ++++++------ 4 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 .changes/nextrelease/multi-auth-update.json diff --git a/.changes/nextrelease/multi-auth-update.json b/.changes/nextrelease/multi-auth-update.json new file mode 100644 index 0000000000..933c408d42 --- /dev/null +++ b/.changes/nextrelease/multi-auth-update.json @@ -0,0 +1,7 @@ +[ + { + "type": "bugfix", + "category": "", + "description": "Updates error level on deprecated `Command` methods. Removes suppressed call to deprecated method." + } +] diff --git a/src/Command.php b/src/Command.php index ca6d59c5a9..b15af4df4e 100644 --- a/src/Command.php +++ b/src/Command.php @@ -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; @@ -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 ?: []; diff --git a/src/EndpointV2/EndpointV2Middleware.php b/src/EndpointV2/EndpointV2Middleware.php index cf0e1ce975..3e897d0b71 100644 --- a/src/EndpointV2/EndpointV2Middleware.php +++ b/src/EndpointV2/EndpointV2Middleware.php @@ -231,7 +231,6 @@ private function applyAuthScheme( ): void { $authScheme = $this->resolveAuthScheme($authSchemes); - @$command->setAuthSchemes($authScheme); $command['@context']['signature_version'] = $authScheme['version']; diff --git a/tests/CommandTest.php b/tests/CommandTest.php index 16f294e093..08d21d7106 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -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.' ); @@ -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.' );