Skip to content

Commit fbe6665

Browse files
committed
Support the actual #[\SensitiveParameter] attribute in stubs
1 parent ff472ce commit fbe6665

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
@@ -3077,6 +3077,21 @@ function parseFunctionLike(
30773077
$varName = $param->var->name;
30783078
$preferRef = !empty($paramMeta[$varName]['prefer-ref']);
30793079
$isSensitive = !empty($paramMeta[$varName]['sensitive-param']);
3080+
foreach ($param->attrGroups as $attrGroup) {
3081+
foreach ($attrGroup->attrs as $attr) {
3082+
switch ($attr->name->toCodeString()) {
3083+
case '\\SensitiveParameter':
3084+
if ($isSensitive) {
3085+
throw new Exception("Redundant {$attr->name->toCodeString()} declaration.");
3086+
}
3087+
3088+
$isSensitive = true;
3089+
break;
3090+
default:
3091+
throw new Exception("Unhandled attribute {$attr->name->toCodeString()}.");
3092+
}
3093+
}
3094+
}
30803095
unset($paramMeta[$varName]);
30813096

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

0 commit comments

Comments
 (0)