Ver código fonte

Fix failure on PHP 5.3.

Also use get_called_class() where possible.
Daniele Alessandri 9 anos atrás
pai
commit
82c256422a

+ 5 - 3
src/Configuration/Option/Aggregate.php

@@ -35,16 +35,18 @@ class Aggregate implements OptionInterface
     protected function getConnectionInitializer(OptionsInterface $options, $callable)
     protected function getConnectionInitializer(OptionsInterface $options, $callable)
     {
     {
         if (!is_callable($callable)) {
         if (!is_callable($callable)) {
-            $class = get_class($this);
+            $class = get_called_class();
 
 
             throw new \InvalidArgumentException("$class expects a valid callable");
             throw new \InvalidArgumentException("$class expects a valid callable");
         }
         }
 
 
-        return function ($parameters = null) use ($callable, $options) {
+        $option = $this;
+
+        return function ($parameters = null) use ($callable, $options, $option) {
             $connection = call_user_func($callable, $options, $parameters);
             $connection = call_user_func($callable, $options, $parameters);
 
 
             if (!$connection instanceof AggregateConnectionInterface) {
             if (!$connection instanceof AggregateConnectionInterface) {
-                $class = get_class($this);
+                $class = get_class($option);
 
 
                 throw new \InvalidArgumentException("$class expects a valid connection type returned by callable initializer");
                 throw new \InvalidArgumentException("$class expects a valid connection type returned by callable initializer");
             }
             }

+ 1 - 1
src/Configuration/Option/Commands.php

@@ -43,7 +43,7 @@ class Commands implements OptionInterface
         }
         }
 
 
         if (!$value instanceof FactoryInterface) {
         if (!$value instanceof FactoryInterface) {
-            $class = get_class($this);
+            $class = get_called_class();
 
 
             throw new \InvalidArgumentException("$class expects a valid command factory");
             throw new \InvalidArgumentException("$class expects a valid command factory");
         }
         }

+ 1 - 1
src/Configuration/Option/Connections.php

@@ -44,7 +44,7 @@ class Connections implements OptionInterface
 
 
             return $factory;
             return $factory;
         } else {
         } else {
-            $class = get_class($this);
+            $class = get_called_class();
 
 
             throw new \InvalidArgumentException("$class expects a valid connection factory");
             throw new \InvalidArgumentException("$class expects a valid connection factory");
         }
         }