# sensitiveparameter

# 

<div data-wrapper="1" role="class">

ENTITY

</div>

<div data-wrapper="1" role="class">

This attribute is used to mark a parameter that is sensitive and should have its value redacted if present in a stack trace.

</div>

# 

<div data-wrapper="1" role="class">

ENTITY

</div>

<div data-wrapper="1" role="attribute">

\#\[\Attribute(\Attribute::TARGET_PARAMETER)\]

</div>

<div data-wrapper="1" role="class">

final

</div>

<div data-wrapper="1" role="class">

SensitiveParameter

</div>

<div data-wrapper="1" role="comment">

ENTITY

</div>

# 

<div data-wrapper="1" role="class">

ENTITY

</div>

<div class="informalexample" role="class">

```
<?php

function defaultBehavior(
    string $secret,
    string $normal
) {
    throw new Exception('Error!');
}

function sensitiveParametersWithAttribute(
    #[\SensitiveParameter]
    string $secret,
    string $normal
) {
    throw new Exception('Error!');
}

try {
    defaultBehavior('password', 'normal');
} catch (Exception $e) {
    echo $e, PHP_EOL, PHP_EOL;
}

try {
    sensitiveParametersWithAttribute('password', 'normal');
} catch (Exception $e) {
    echo $e, PHP_EOL, PHP_EOL;
}

?>

    
```

ENTITY

    Exception: Error! in example.php:7
    Stack trace:
    #0 example.php(19): defaultBehavior('password', 'normal')
    #1 {main}

    Exception: Error! in example.php:15
    Stack trace:
    #0 example.php(25): sensitiveParametersWithAttribute(Object(SensitiveParameterValue), 'normal')
    #1 {main}

        

</div>

# 

<div data-wrapper="1" role="class">

ENTITY

</div>

<div data-wrapper="1" role="class">

[Attributes overview](#language.attributes), `SensitiveParameterValue`

</div>

<div data-wrapper="1" role="class">

ENTITY

</div>