@@ -56,7 +56,8 @@ discard block |
||
| 56 | 56 | return static::varExport($argument, ['short_objects' => $short_objects, 'max_length' => $max_param_length]); |
| 57 | 57 | }, $call['arguments'])); |
| 58 | 58 | $string .= ')'; |
| 59 | - } else { |
|
| 59 | + } |
|
| 60 | + else { |
|
| 60 | 61 | $string .= '[' . static::varExport($call['entry'], ['short_objects' => $short_objects, 'max_length' => $max_param_length]) . ']'; |
| 61 | 62 | } |
| 62 | 63 | if (!empty($options['limit']) && $options['limit'] == $i) { |
@@ -86,7 +87,8 @@ discard block |
||
| 86 | 87 | if (is_object($variable)) { |
| 87 | 88 | // shortening short objects would only slow the workflow |
| 88 | 89 | $export = get_class($variable) . ' #' . spl_object_id($variable); |
| 89 | - } elseif (is_string($variable)) { |
|
| 90 | + } |
|
| 91 | + elseif (is_string($variable)) { |
|
| 90 | 92 | $keep_length = floor(($options['max_length'] - 5) / 2); |
| 91 | 93 | $export = substr($variable, 0, (int) $keep_length) . ' ... ' . substr($variable, -$keep_length); |
| 92 | 94 | } |
@@ -79,24 +79,29 @@ discard block |
||
| 79 | 79 | throw new TargetAlreadyDefinedException($this, $this->expectedTarget, $target); |
| 80 | 80 | } |
| 81 | 81 | $out = $this->expectedTarget; |
| 82 | - } elseif (is_string($this->expectedTarget)) { |
|
| 82 | + } |
|
| 83 | + elseif (is_string($this->expectedTarget)) { |
|
| 83 | 84 | if (class_exists($this->expectedTarget)) { |
| 84 | 85 | if (!$target instanceof $this->expectedTarget) { |
| 85 | 86 | throw new BadTargetClassException($this, $this->expectedTarget, $target); |
| 86 | 87 | } |
| 87 | - } elseif (interface_exists($this->expectedTarget)) { |
|
| 88 | + } |
|
| 89 | + elseif (interface_exists($this->expectedTarget)) { |
|
| 88 | 90 | if (!$target instanceof $this->expectedTarget) { |
| 89 | 91 | throw new BadTargetInterfaceException($this, $this->expectedTarget, $target); |
| 90 | 92 | } |
| 91 | - } elseif (type_exists($this->expectedTarget)) { |
|
| 93 | + } |
|
| 94 | + elseif (type_exists($this->expectedTarget)) { |
|
| 92 | 95 | if (gettype($target) != $this->expectedTarget) { |
| 93 | 96 | throw new BadTargetTypeException($this, $this->expectedTarget, $target); |
| 94 | 97 | } |
| 95 | - } else { |
|
| 98 | + } |
|
| 99 | + else { |
|
| 96 | 100 | throw new UndefinedTargetClassException($this, $this->expectedTarget); |
| 97 | 101 | } |
| 98 | 102 | $out = $target; |
| 99 | - } else { |
|
| 103 | + } |
|
| 104 | + else { |
|
| 100 | 105 | $out = $target; |
| 101 | 106 | } |
| 102 | 107 | return $out; |
@@ -118,19 +123,23 @@ discard block |
||
| 118 | 123 | try { |
| 119 | 124 | if ($method_type == '->') { |
| 120 | 125 | $callable = [$current_chained_subject, $method_name]; |
| 121 | - } elseif ($method_type == '::') { |
|
| 126 | + } |
|
| 127 | + elseif ($method_type == '::') { |
|
| 122 | 128 | if (is_object($current_chained_subject)) { |
| 123 | 129 | $class = get_class($current_chained_subject); |
| 124 | - } elseif (is_string($current_chained_subject)) { |
|
| 130 | + } |
|
| 131 | + elseif (is_string($current_chained_subject)) { |
|
| 125 | 132 | $class = $current_chained_subject; |
| 126 | 133 | } |
| 127 | 134 | $callable = $class . '::' . $method_name; |
| 128 | 135 | } |
| 129 | 136 | $current_chained_subject = call_user_func_array($callable, $arguments); |
| 130 | - } catch (\BadMethodCallException $e) { |
|
| 137 | + } |
|
| 138 | + catch (\BadMethodCallException $e) { |
|
| 131 | 139 | if ($this->exceptionTrownFromMagicCall($e->getTrace(), $current_chained_subject, $method_name)) { |
| 132 | 140 | $is_called = false; |
| 133 | - } else { |
|
| 141 | + } |
|
| 142 | + else { |
|
| 134 | 143 | throw $e; |
| 135 | 144 | } |
| 136 | 145 | } |
@@ -180,10 +189,12 @@ discard block |
||
| 180 | 189 | if (!$is_called) { |
| 181 | 190 | throw new \BadMethodCallException($call['method'] . "() is neither a method of " . (is_string($out) ? $out : get_class($out)) . " nor a function"); |
| 182 | 191 | } |
| 183 | - } else { |
|
| 192 | + } |
|
| 193 | + else { |
|
| 184 | 194 | $out = $out[$call['entry']]; |
| 185 | 195 | } |
| 186 | - } catch (\Exception $e) { |
|
| 196 | + } |
|
| 197 | + catch (\Exception $e) { |
|
| 187 | 198 | $callchain_description = $this->toString(['target' => $target, 'limit' => $i]); |
| 188 | 199 | VisibilityViolator::setHiddenProperty($e, 'message', $e->getMessage() . "\nWhen applying {$callchain_description} defined at " . $call['file'] . ':' . $call['line']); |
| 189 | 200 | // Throw $e with the good stack (usage exception) |