Skip to content

Commit 6057de2

Browse files
committed
chore: upgraded to PHPStan v2 and Rector v2
1 parent 6012d5b commit 6057de2

File tree

8 files changed

+69
-66
lines changed

8 files changed

+69
-66
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555
"mikey179/vfsstream": "^1.6",
5656
"phpdocumentor/reflection-docblock": "5.*",
5757
"phpmd/phpmd": "@stable",
58-
"phpstan/phpstan": "^1.0.0",
58+
"phpstan/phpstan": "^2",
5959
"phpunit/phpunit": "11.*",
60-
"rector/rector": "^1.0.0",
60+
"rector/rector": "^2",
6161
"squizlabs/php_codesniffer": "3.*",
6262
"symfony/yaml": "7.*",
6363
"zircote/swagger-php": "^4.8"

composer.lock

Lines changed: 60 additions & 57 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpmyfaq/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
// Validating token from 2FA if given; else: returns error message
168168
//
169169
if ($token !== '' && !is_null($userId)) {
170-
if (strlen((string)$token) === 6 && is_numeric((string)$token)) {
170+
if (strlen($token) === 6 && is_numeric((string)$token)) {
171171
$user = new CurrentUser($faqConfig);
172172
$user->getUserById($userId);
173173
$tfa = new TwoFactor($faqConfig, $user);

phpmyfaq/src/phpMyFAQ/Controller/Administration/AuthenticationController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function check(Request $request): Response
186186
return new RedirectResponse('./');
187187
}
188188

189-
$token = Filter::filterVar($request->get('token'), FILTER_VALIDATE_INT);
189+
$token = Filter::filterVar($request->get('token'), FILTER_SANITIZE_SPECIAL_CHARS);
190190
$userId = Filter::filterVar($request->get('user-id'), FILTER_VALIDATE_INT);
191191

192192
$user = $this->container->get('phpmyfaq.user.current_user');

phpmyfaq/src/phpMyFAQ/User/CurrentUser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ public static function getCurrentUserGroupId(?CurrentUser $user = null): array
486486
$currentGroups = [-1];
487487
}
488488

489-
if (0 === (is_countable($currentGroups) ? count($currentGroups) : 0)) {
489+
if (count($currentGroups)) {
490490
$currentGroups = [-1];
491491
}
492492
} else {

phpmyfaq/src/phpMyFAQ/User/TwoFactor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ public function getSecret(CurrentUser $currentUser): string|null
8585
/**
8686
* Validates a given token. Returns true if the token is correct.
8787
*/
88-
public function validateToken(int $token, int $userId): bool
88+
public function validateToken(string $token, int $userId): bool
8989
{
90-
if (strlen((string)$token) !== 6) {
90+
if (strlen($token) !== 6) {
9191
return false;
9292
}
9393

0 commit comments

Comments
 (0)