Skip to content

Commit ce9441a

Browse files
committed
Remove use of Reflection.
1 parent de13e6c commit ce9441a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

RabbitMq/AMQPConnectionFactory.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@ class AMQPConnectionFactory
2121
'heartbeat' => 0,
2222
);
2323

24+
/**
25+
* Constructor
26+
*
27+
* @param string $class FQCN of AMQPConnection class to instantiate.
28+
* @param array $parameters Map containing parameters resolved by Extension.
29+
*/
2430
public function __construct($class, array $parameters)
2531
{
26-
if (is_string($class)) {
27-
$class = new \ReflectionClass($class);
28-
}
2932
$this->class = $class;
3033
$this->parameters = array_merge($this->parameters, $parameters);
3134
if (is_array($this->parameters['ssl_context'])) {
@@ -37,7 +40,7 @@ public function __construct($class, array $parameters)
3740

3841
public function createConnection()
3942
{
40-
return $this->class->newInstance(
43+
return new $this->class(
4144
$this->parameters['host'],
4245
$this->parameters['port'],
4346
$this->parameters['user'],

0 commit comments

Comments
 (0)