Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Commit 9c2e2ea

Browse files
author
Robin Chalas
committed
minor #29779 [Security] Declare exceptions that are already thrown by implementations (umulmrum)
This PR was merged into the 3.4 branch. Discussion ---------- [Security] Declare exceptions that are already thrown by implementations | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #29650 | License | MIT | Doc PR | Adding exception declarations for PasswordEncoderInterface. I think it's a matter of opinion whether this change is a BC break. The BC promise doesn't cover such a case; I'd see it as a BC break to add exceptions in general, but in this case it's more of a "documentation" issue, as most implementations of the interface have been throwing those exceptions for years. Commits ------- f4cc30b72b Declare exceptions that are already thrown by implementations
2 parents bc8d8d2 + 758c980 commit 9c2e2ea

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Core/Encoder/PasswordEncoderInterface.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Security\Core\Encoder;
1313

14+
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
15+
1416
/**
1517
* PasswordEncoderInterface is the interface for all encoders.
1618
*
@@ -25,6 +27,9 @@ interface PasswordEncoderInterface
2527
* @param string $salt The salt
2628
*
2729
* @return string The encoded password
30+
*
31+
* @throws BadCredentialsException If the raw password is invalid, e.g. excessively long
32+
* @throws \InvalidArgumentException If the salt is invalid
2833
*/
2934
public function encodePassword($raw, $salt);
3035

@@ -36,6 +41,8 @@ public function encodePassword($raw, $salt);
3641
* @param string $salt The salt
3742
*
3843
* @return bool true if the password is valid, false otherwise
44+
*
45+
* @throws \InvalidArgumentException If the salt is invalid
3946
*/
4047
public function isPasswordValid($encoded, $raw, $salt);
4148
}

0 commit comments

Comments
 (0)