Skip to content

Commit 7e8b84e

Browse files
committed
[Security] Avoid unnecessary usage of Reflection
1 parent 9d3d07a commit 7e8b84e

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Encoder/EncoderFactory.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ private function createEncoder(array $config, bool $isExtra = false): PasswordEn
7878
throw new \InvalidArgumentException(sprintf('"arguments" must be set in %s.', json_encode($config)));
7979
}
8080

81-
$reflection = new \ReflectionClass($config['class']);
82-
83-
$encoder = $reflection->newInstanceArgs($config['arguments']);
81+
$encoder = new $config['class'](...$config['arguments']);
8482

8583
if ($isExtra || !\in_array($config['class'], [NativePasswordEncoder::class, SodiumPasswordEncoder::class], true)) {
8684
return $encoder;

0 commit comments

Comments
 (0)