Skip to content

Commit 932fb0e

Browse files
committed
Support the actual #[\SensitiveParameter] attribute in stubs
1 parent 9f29e2d commit 932fb0e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

build/gen_stub.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3142,6 +3142,21 @@ function parseFunctionLike(
31423142
$varName = $param->var->name;
31433143
$preferRef = !empty($paramMeta[$varName]['prefer-ref']);
31443144
$isSensitive = !empty($paramMeta[$varName]['sensitive-param']);
3145+
foreach ($param->attrGroups as $attrGroup) {
3146+
foreach ($attrGroup->attrs as $attr) {
3147+
switch ($attr->name->toCodeString()) {
3148+
case '\\SensitiveParameter':
3149+
if ($isSensitive) {
3150+
throw new Exception("Redundant {$attr->name->toCodeString()} declaration.");
3151+
}
3152+
3153+
$isSensitive = true;
3154+
break;
3155+
default:
3156+
throw new Exception("Unhandled attribute {$attr->name->toCodeString()}.");
3157+
}
3158+
}
3159+
}
31453160
unset($paramMeta[$varName]);
31463161

31473162
if (isset($varNameSet[$varName])) {

0 commit comments

Comments
 (0)