Skip to content

Commit b501424

Browse files
committed
[TASK] Trying to fix phpstan error
Signed-off-by: Torben Hansen <derhansen@gmail.com>
1 parent d8423c7 commit b501424

2 files changed

Lines changed: 40 additions & 39 deletions

File tree

.Build/composer.json

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
11
{
2-
"name": "derhansen/add_pwd_policy_composer_v14",
3-
"description": "composer.json for TYPO3 v14 build",
4-
"keywords": [
5-
"TYPO3 CMS",
6-
"security",
7-
"password policy",
8-
"password validators"
9-
],
10-
"repositories": [
11-
{
12-
"type": "path",
13-
"url": "../../"
14-
}
15-
],
16-
"require": {
17-
"typo3/cms-core": "^14.3",
18-
"typo3/cms-setup": "^14.3",
19-
"typo3/cms-backend": "^14.3",
20-
"typo3/cms-felogin": "^14.3",
21-
"derhansen/add_pwd_policy": "@dev"
22-
},
23-
"require-dev": {
24-
"typo3/cms-composer-installers": "^5.0",
25-
"typo3/testing-framework": "^9.0.0",
26-
"friendsofphp/php-cs-fixer": "^3.49",
27-
"phpstan/phpstan": "^2.1",
28-
"phpstan/extension-installer": "^1.1"
29-
},
30-
"config": {
31-
"lock": false,
32-
"allow-plugins": {
33-
"typo3/class-alias-loader": true,
34-
"typo3/cms-composer-installers": true,
35-
"phpstan/extension-installer": true
36-
}
37-
}
2+
"name": "derhansen/add_pwd_policy_composer_v14",
3+
"description": "composer.json for TYPO3 v14 build",
4+
"keywords": [
5+
"TYPO3 CMS",
6+
"security",
7+
"password policy",
8+
"password validators"
9+
],
10+
"repositories": [
11+
{
12+
"type": "path",
13+
"url": "../../"
14+
}
15+
],
16+
"require": {
17+
"typo3/cms-core": "^14.3",
18+
"typo3/cms-setup": "^14.3",
19+
"typo3/cms-backend": "^14.3",
20+
"typo3/cms-felogin": "^14.3",
21+
"derhansen/add_pwd_policy": "@dev"
22+
},
23+
"require-dev": {
24+
"typo3/cms-composer-installers": "^5.0",
25+
"typo3/testing-framework": "^9.0.0",
26+
"friendsofphp/php-cs-fixer": "^3.49",
27+
"phpstan/phpstan": "^2.1",
28+
"saschaegerer/phpstan-typo3": "^3.0",
29+
"phpstan/extension-installer": "^1.1"
30+
},
31+
"config": {
32+
"lock": false,
33+
"allow-plugins": {
34+
"typo3/class-alias-loader": true,
35+
"typo3/cms-composer-installers": true,
36+
"phpstan/extension-installer": true
37+
}
38+
}
3839
}

Classes/Service/PwnedPasswordsService.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@
1212
namespace Derhansen\AddPwdPolicy\Service;
1313

1414
use TYPO3\CMS\Core\Http\RequestFactory;
15-
use TYPO3\CMS\Core\Utility\GeneralUtility;
1615

1716
class PwnedPasswordsService
1817
{
18+
public function __construct(private readonly RequestFactory $requestFactory) {}
19+
1920
/**
2021
* Checks the given password against data breaches using the haveibeenpwned.com API
2122
* Returns the amount of times the password is found in the haveibeenpwned.com database
2223
*/
2324
public function checkPassword(string $password): int
2425
{
2526
$hash = sha1($password);
26-
$request = GeneralUtility::makeInstance(RequestFactory::class);
2727

28-
$response = $request->request(
28+
$response = $this->requestFactory->request(
2929
'https://api.pwnedpasswords.com/range/' . substr($hash, 0, 5),
3030
'GET',
3131
[

0 commit comments

Comments
 (0)