summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-01-13 15:11:16 +0100
committerGitHub <noreply@github.com>2018-01-13 15:11:16 +0100
commit60f38d37fe5ca505258510adc1e106da54426510 (patch)
tree8eec0f6c9104361a9e82902270dedc767cf68453
parent1faef0c459a51a025f73f7eee46e5607ee6eedf5 (diff)
parent8d1dd1945fa6f5f382224da6bbd333ded8f2a31f (diff)
downloadnextcloud-server-60f38d37fe5ca505258510adc1e106da54426510.tar.gz
nextcloud-server-60f38d37fe5ca505258510adc1e106da54426510.zip
Merge pull request #7825 from nextcloud/add-type-hinting-for-ICrypto-decrypt
Adds type hinting for scalar types in ICrypto->decrypt
-rw-r--r--lib/private/Security/Crypto.php2
-rw-r--r--lib/public/Security/ICrypto.php2
-rw-r--r--tests/Core/Controller/LostControllerTest.php4
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/private/Security/Crypto.php b/lib/private/Security/Crypto.php
index 1dd680ea13f..d2be1484279 100644
--- a/lib/private/Security/Crypto.php
+++ b/lib/private/Security/Crypto.php
@@ -108,7 +108,7 @@ class Crypto implements ICrypto {
* @return string plaintext
* @throws \Exception If the HMAC does not match
*/
- public function decrypt($authenticatedCiphertext, $password = '') {
+ public function decrypt(string $authenticatedCiphertext, string $password = ''): string {
if($password === '') {
$password = $this->config->getSystemValue('secret');
}
diff --git a/lib/public/Security/ICrypto.php b/lib/public/Security/ICrypto.php
index 0de2e47b755..aa2b9eed2c0 100644
--- a/lib/public/Security/ICrypto.php
+++ b/lib/public/Security/ICrypto.php
@@ -61,5 +61,5 @@ interface ICrypto {
* @throws \Exception If the HMAC does not match
* @since 8.0.0
*/
- public function decrypt($authenticatedCiphertext, $password = '');
+ public function decrypt(string $authenticatedCiphertext, string $password = ''): string;
}
diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php
index 1e51de649e3..f35d3b37b80 100644
--- a/tests/Core/Controller/LostControllerTest.php
+++ b/tests/Core/Controller/LostControllerTest.php
@@ -653,14 +653,14 @@ class LostControllerTest extends \Test\TestCase {
public function testIsSetPasswordWithoutTokenFailing() {
$this->config->method('getUserValue')
->with('ValidTokenUser', 'core', 'lostpassword', null)
- ->will($this->returnValue(null));
+ ->willReturn('aValidtoken');
$this->userManager->method('get')
->with('ValidTokenUser')
->willReturn($this->existingUser);
$this->crypto->method('decrypt')
->with(
- $this->equalTo(''),
+ $this->equalTo('aValidtoken'),
$this->equalTo('test@example.comSECRET')
)->willThrowException(new \Exception());