minor #34308 [Security] Avoid unnecessary usage of Reflection (chalasr)

This PR was merged into the 4.4 branch.

Discussion
----------

[Security] Avoid unnecessary usage of Reflection

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

2377418443 [Security] Avoid unnecessary usage of Reflection
This commit is contained in:
Robin Chalas 2019-11-09 23:27:08 +01:00
commit d5ba53547e
1 changed files with 1 additions and 3 deletions

View File

@ -78,9 +78,7 @@ class EncoderFactory implements EncoderFactoryInterface
throw new \InvalidArgumentException(sprintf('"arguments" must be set in %s.', json_encode($config)));
}
$reflection = new \ReflectionClass($config['class']);
$encoder = $reflection->newInstanceArgs($config['arguments']);
$encoder = new $config['class'](...$config['arguments']);
if ($isExtra || !\in_array($config['class'], [NativePasswordEncoder::class, SodiumPasswordEncoder::class], true)) {
return $encoder;