Skip to content

Commit 085add0

Browse files
committed
Support the actual #[\SensitiveParameter] attribute in stubs
1 parent bb5be65 commit 085add0

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
@@ -3261,6 +3261,21 @@ function parseFunctionLike(
32613261
$varName = $param->var->name;
32623262
$preferRef = !empty($paramMeta[$varName]['prefer-ref']);
32633263
$isSensitive = !empty($paramMeta[$varName]['sensitive-param']);
3264+
foreach ($param->attrGroups as $attrGroup) {
3265+
foreach ($attrGroup->attrs as $attr) {
3266+
switch ($attr->name->toCodeString()) {
3267+
case '\\SensitiveParameter':
3268+
if ($isSensitive) {
3269+
throw new Exception("Redundant {$attr->name->toCodeString()} declaration.");
3270+
}
3271+
3272+
$isSensitive = true;
3273+
break;
3274+
default:
3275+
throw new Exception("Unhandled attribute {$attr->name->toCodeString()}.");
3276+
}
3277+
}
3278+
}
32643279
unset($paramMeta[$varName]);
32653280

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

0 commit comments

Comments
 (0)