Closed
Description
Before submitting a bug report:
- Make sure you are able to repro it on the latest released version
- Perform a quick search for existing issues to check if this bug has already been reported
Steps to reproduce
$n = "envVarName"
${env:$n} = "Value"
Expected behavior
No warning for unused variable 'n'
Actual behavior
The variable 'n' is assigned but never used. (PSUseDeclaredVarsMoreThanAssignments)
If an unexpected error was thrown then please report the full error details using e.g. $error[0] | Select-Object *
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.2
PSEdition Core
GitCommitId v6.0.2
OS Microsoft Windows 10.0.16299
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.17.1
1.16.1