Переглянути джерело

Fix failure on PHP 5.3.

Also use get_called_class() where possible.
Daniele Alessandri 9 роки тому
батько
коміт
82c256422a

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

@@ -35,16 +35,18 @@ class Aggregate implements OptionInterface
     protected function getConnectionInitializer(OptionsInterface $options, $callable)
     {
         if (!is_callable($callable)) {
-            $class = get_class($this);
+            $class = get_called_class();
 
             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);
 
             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");
             }

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

@@ -43,7 +43,7 @@ class Commands implements OptionInterface
         }
 
         if (!$value instanceof FactoryInterface) {
-            $class = get_class($this);
+            $class = get_called_class();
 
             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;
         } else {
-            $class = get_class($this);
+            $class = get_called_class();
 
             throw new \InvalidArgumentException("$class expects a valid connection factory");
         }