@@ -98,7 +98,7 @@ |
||
| 98 | 98 | * @param array $arguments An array of arguments for the method call |
| 99 | 99 | * @return mixed The returned value of the method |
| 100 | 100 | */ |
| 101 | - public static function callHiddenMethod($objectOrClassName, $name, array $arguments=[]) |
|
| 101 | + public static function callHiddenMethod($objectOrClassName, $name, array $arguments = []) |
|
| 102 | 102 | { |
| 103 | 103 | list($className, $object) = self::extractClassNameAndObject($objectOrClassName); |
| 104 | 104 | |
@@ -20,20 +20,17 @@ discard block |
||
| 20 | 20 | if (is_object($objectOrClassName)) { |
| 21 | 21 | $object = $objectOrClassName; |
| 22 | 22 | $className = get_class($objectOrClassName); |
| 23 | - } |
|
| 24 | - elseif (is_string($objectOrClassName)) { |
|
| 23 | + } elseif (is_string($objectOrClassName)) { |
|
| 25 | 24 | if (!class_exists($objectOrClassName)) { |
| 26 | 25 | throw new \InvalidArgumentException( |
| 27 | 26 | "The provided class name corresponds to no defined class: '$objectOrClassName'" |
| 28 | 27 | ); |
| 29 | - } |
|
| 30 | - else { |
|
| 28 | + } else { |
|
| 31 | 29 | $className = $objectOrClassName; |
| 32 | 30 | } |
| 33 | 31 | |
| 34 | 32 | $object = null; |
| 35 | - } |
|
| 36 | - else { |
|
| 33 | + } else { |
|
| 37 | 34 | throw new \InvalidArgumentException( |
| 38 | 35 | "\$objectOrClassName must be an instance or a class name including its namespace" |
| 39 | 36 | ." instead of ".var_export($objectOrClassName, true) |
@@ -84,10 +81,11 @@ discard block |
||
| 84 | 81 | $reflectionProperty = $reflectionClass->getProperty($name); |
| 85 | 82 | $reflectionProperty->setAccessible(true); |
| 86 | 83 | |
| 87 | - if ($object) |
|
| 88 | - $reflectionProperty->setValue($object, $value); |
|
| 89 | - else |
|
| 90 | - $reflectionProperty->setValue($value); |
|
| 84 | + if ($object) { |
|
| 85 | + $reflectionProperty->setValue($object, $value); |
|
| 86 | + } else { |
|
| 87 | + $reflectionProperty->setValue($value); |
|
| 88 | + } |
|
| 91 | 89 | } |
| 92 | 90 | |
| 93 | 91 | /** |