Skip to content

Files

Latest commit

 

History

History
45 lines (34 loc) · 738 Bytes

AvoidMultipleTypeAttributes.md

File metadata and controls

45 lines (34 loc) · 738 Bytes

Pattern: Use of multiple type attribute

Issue: -

Description

Parameters should not have more than one type specifier. Multiple type specifiers on parameters can cause runtime errors.

How

Ensure each parameter has only 1 type specifier.

Example of incorrect code:

function Test-Script
{
    [CmdletBinding()]
    Param
    (
        [switch]
        [int]
        $Switch
    )
}

Example of correct code:

function Test-Script
{
    [CmdletBinding()]
    Param
    (
        [switch]
        $Switch
    )
}

Further Reading