Merge pull request #56790 from nextcloud/refactor/password-confirm-attribute-getstrict

refactor: improve reflection attribute typing
pull/56751/head
Andy Scherzinger 2025-12-04 19:04:27 +07:00 committed by GitHub
commit 3cdfe6dbfa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

@ -24,6 +24,7 @@ use OCP\IUserSession;
use OCP\Session\Exceptions\SessionNotAvailableException;
use OCP\User\Backend\IPasswordConfirmationBackend;
use Psr\Log\LoggerInterface;
use ReflectionAttribute;
use ReflectionMethod;
class PasswordConfirmationMiddleware extends Middleware {
@ -115,6 +116,7 @@ class PasswordConfirmationMiddleware extends Middleware {
}
private function isPasswordConfirmationStrict(ReflectionMethod $reflectionMethod): bool {
/** @var ReflectionAttribute<PasswordConfirmationRequired>[] $attributes */
$attributes = $reflectionMethod->getAttributes(PasswordConfirmationRequired::class);
return !empty($attributes) && ($attributes[0]->newInstance()->getStrict());
}