Skip to content

Commit 8a581c2

Browse files
ChristophWurstAndyScherzinger
authored andcommitted
refactor: improve reflection attribute typing
This allows tools to see the correct usage of PasswordConfirmationRequired::getStrict Signed-off-by: Christoph Wurst <[email protected]>
1 parent 1ef465f commit 8a581c2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use OCP\Session\Exceptions\SessionNotAvailableException;
2525
use OCP\User\Backend\IPasswordConfirmationBackend;
2626
use Psr\Log\LoggerInterface;
27+
use ReflectionAttribute;
2728
use ReflectionMethod;
2829

2930
class PasswordConfirmationMiddleware extends Middleware {
@@ -115,6 +116,7 @@ private function needsPasswordConfirmation(ReflectionMethod $reflectionMethod):
115116
}
116117

117118
private function isPasswordConfirmationStrict(ReflectionMethod $reflectionMethod): bool {
119+
/** @var ReflectionAttribute<PasswordConfirmationRequired>[] $attributes */
118120
$attributes = $reflectionMethod->getAttributes(PasswordConfirmationRequired::class);
119121
return !empty($attributes) && ($attributes[0]->newInstance()->getStrict());
120122
}

0 commit comments

Comments
 (0)