refactor: improve reflection attribute typing

This allows tools to see the correct usage of
PasswordConfirmationRequired::getStrict

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
pull/56790/head
Christoph Wurst 2025-12-02 09:55:41 +07:00 committed by Andy Scherzinger
parent 1ef465f804
commit 8a581c230b
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());
}