Skip to content

Commit e2a2733

Browse files
committed
fix: corrected code formatting
1 parent 487eb10 commit e2a2733

5 files changed

Lines changed: 10 additions & 13 deletions

File tree

phpmyfaq/src/phpMyFAQ/Strings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Strings
3737
/**
3838
* Instance.
3939
*/
40-
private static null|Mbstring|StringBasic $instance = null;
40+
private static Mbstring|StringBasic|null $instance = null;
4141

4242
/**
4343
* Constructor.

phpmyfaq/src/phpMyFAQ/Strings/Mbstring.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public static function getInstance(string $language = 'en'): Mbstring
4949
self::$mbstring = new self();
5050
self::$mbstring->encoding = self::DEFAULT_ENCODING;
5151
self::$mbstring->language = Language::isASupportedLanguage($language) ? $language : self::DEFAULT_LANGUAGE;
52+
5253
// Note: the regex helpers use PCRE (preg_* with the /u modifier), not the
5354
// mb_ereg* family, so mb_regex_encoding() is unnecessary here. It is also
5455
// deprecated as of PHP 8.6 (the underlying oniguruma library is unmaintained).

tests/phpMyFAQ/Auth/AuthDatabaseTest.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,11 @@ public function testCheckCredentialsAcceptsLegacySha256AndRehashesToBcrypt(): vo
177177
// Seed a legacy SHA-256 hash directly, bypassing create() (which now writes bcrypt).
178178
$salt = $configuration->get('security.salt') . $login;
179179
$legacyHash = hash('sha256', $password . $salt);
180-
$driver->query(
181-
sprintf(
182-
"INSERT INTO faquserlogin (login, pass, domain) VALUES ('%s', '%s', '')",
183-
$driver->escape($login),
184-
$driver->escape($legacyHash),
185-
),
186-
);
180+
$driver->query(sprintf(
181+
"INSERT INTO faquserlogin (login, pass, domain) VALUES ('%s', '%s', '')",
182+
$driver->escape($login),
183+
$driver->escape($legacyHash),
184+
));
187185

188186
// Legacy password is accepted...
189187
static::assertTrue($this->authDatabase->checkCredentials($login, $password));
@@ -200,9 +198,7 @@ private function readStoredHash(string $login): string
200198
$reflection = new \ReflectionClass($this->authDatabase);
201199
$driver = $reflection->getProperty('databaseDriver')->getValue($this->authDatabase);
202200

203-
$result = $driver->query(
204-
sprintf("SELECT pass FROM faquserlogin WHERE login = '%s'", $driver->escape($login)),
205-
);
201+
$result = $driver->query(sprintf("SELECT pass FROM faquserlogin WHERE login = '%s'", $driver->escape($login)));
206202
$row = $driver->fetchArray($result);
207203

208204
return $row['pass'];

tests/phpMyFAQ/Controller/Api/CategoryControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private function authorizeCurrentUser(AbstractController $controller, int $userI
109109
$currentUser->method('isLoggedIn')->willReturn(true);
110110
$currentUser->method('getUserId')->willReturn($userId);
111111

112-
(new \ReflectionProperty(AbstractController::class, 'currentUser'))->setValue($controller, $currentUser);
112+
new \ReflectionProperty(AbstractController::class, 'currentUser')->setValue($controller, $currentUser);
113113
}
114114

115115
/**

tests/phpMyFAQ/Controller/Api/FaqControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private function authorizeCurrentUser(AbstractController $controller, int $userI
117117
$currentUser->method('isLoggedIn')->willReturn(true);
118118
$currentUser->method('getUserId')->willReturn($userId);
119119

120-
(new \ReflectionProperty(AbstractController::class, 'currentUser'))->setValue($controller, $currentUser);
120+
new \ReflectionProperty(AbstractController::class, 'currentUser')->setValue($controller, $currentUser);
121121
}
122122

123123
/**

0 commit comments

Comments
 (0)