Skip to content

Commit

Permalink
Replace dynamic New-Object usage with ::new()
Browse files Browse the repository at this point in the history
  • Loading branch information
fflaten committed May 18, 2024
1 parent 56fb9a2 commit 2af4c62
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/functions/Mock.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,7 @@ function Get-DynamicParametersForCmdlet {
$Parameters = @{ }
}

$cmdlet = & $SafeCommands['New-Object'] $command.ImplementingType.FullName
$cmdlet = ($command.ImplementingType)::new()

$flags = [System.Reflection.BindingFlags]'Instance, Nonpublic'
$context = $ExecutionContext.GetType().GetField('_context', $flags).GetValue($ExecutionContext)
Expand Down

0 comments on commit 2af4c62

Please sign in to comment.