@@ -41,10 +41,17 @@ |
||
| 41 | 41 | $this->method1(array(1, 2), new stdClass()); // this arguments will be displayed in error backtrace |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | + /** |
|
| 45 | + * @param integer[] $a |
|
| 46 | + * @param stdClass $b |
|
| 47 | + */ |
|
| 44 | 48 | protected function method1($a, $b) { |
| 45 | 49 | $this->method2('some long string argument'); |
| 46 | 50 | } |
| 47 | 51 | |
| 52 | + /** |
|
| 53 | + * @param string $c |
|
| 54 | + */ |
|
| 48 | 55 | public function method2($c) { |
| 49 | 56 | file_get_contents('not_existed.file'); // E_WARNING error |
| 50 | 57 | } |
@@ -14,10 +14,17 @@ |
||
| 14 | 14 | $this->method1(array(1, 2), new stdClass()); // this arguments will be displayed in error backtrace |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | + /** |
|
| 18 | + * @param integer[] $a |
|
| 19 | + * @param stdClass $b |
|
| 20 | + */ |
|
| 17 | 21 | protected function method1($a, $b) { |
| 18 | 22 | $this->method2('some long string argument'); |
| 19 | 23 | } |
| 20 | 24 | |
| 25 | + /** |
|
| 26 | + * @param string $c |
|
| 27 | + */ |
|
| 21 | 28 | public function method2($c) { |
| 22 | 29 | echo $undefinedVar; // E_NOTICE error |
| 23 | 30 | file_get_contents('not_existed.file'); // E_WARNING error |
@@ -30,8 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | try { |
| 32 | 32 | throw new Exception('Some caught exception'); |
| 33 | -} |
|
| 34 | -catch(Exception $exception) { |
|
| 33 | +} catch(Exception $exception) { |
|
| 35 | 34 | $handler->handleException($exception); |
| 36 | 35 | } |
| 37 | 36 | |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | * Send debug data message to client |
| 24 | 24 | * @param mixed $data |
| 25 | 25 | * @param null|string $tags Tags separated by dot, e.g. "low.db.billing" |
| 26 | - * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore |
|
| 26 | + * @param integer $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore |
|
| 27 | 27 | */ |
| 28 | 28 | public function dispatchDebug($data, $tags = null, $ignoreTraceCalls = 0) { |
| 29 | 29 | if($this->isActive()) { |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | * @param null|string $text |
| 53 | 53 | * @param null|string $file |
| 54 | 54 | * @param null|integer $line |
| 55 | - * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore |
|
| 55 | + * @param integer $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore |
|
| 56 | 56 | */ |
| 57 | 57 | public function dispatchError($code = null, $text = null, $file = null, $line = null, $ignoreTraceCalls = 0) { |
| 58 | 58 | if($this->isActive()) { |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Call added code handlers |
| 72 | - * @param $code |
|
| 73 | - * @return mixed |
|
| 72 | + * @param string $code |
|
| 73 | + * @return string |
|
| 74 | 74 | */ |
| 75 | 75 | protected function applyHandlersToCode($code) { |
| 76 | 76 | foreach($this->codeCallbackHandlers as $callback) { |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | 109 | * Execute code with shared vars |
| 110 | - * @param $_code |
|
| 110 | + * @param string $_code |
|
| 111 | 111 | * @param array $_sharedVars |
| 112 | 112 | * @return mixed |
| 113 | 113 | */ |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | /** |
| 164 | 164 | * Protect response code access only to specified directories using http://www.php.net/manual/en/ini.core.php#ini.open-basedir |
| 165 | 165 | * IMPORTANT: classes autoload methods will work only for specified directories |
| 166 | - * @param array $openBaseDirs |
|
| 166 | + * @param string[] $openBaseDirs |
|
| 167 | 167 | * @codeCoverageIgnore |
| 168 | 168 | */ |
| 169 | 169 | public function setOpenBaseDirs(array $openBaseDirs) { |
@@ -40,11 +40,9 @@ discard block |
||
| 40 | 40 | $startTime = microtime(true); |
| 41 | 41 | try { |
| 42 | 42 | $result->return = static::executeCode($code, $this->sharedVars); |
| 43 | - } |
|
| 44 | - catch(\Throwable $exception) { |
|
| 43 | + } catch(\Throwable $exception) { |
|
| 45 | 44 | $result->exception = $exception; |
| 46 | - } |
|
| 47 | - catch(\Exception $exception) { |
|
| 45 | + } catch(\Exception $exception) { |
|
| 48 | 46 | $result->exception = $exception; |
| 49 | 47 | } |
| 50 | 48 | $result->time = abs(microtime(true) - $startTime - $selfTime); |
@@ -115,8 +113,7 @@ discard block |
||
| 115 | 113 | foreach($_sharedVars as $var => $value) { |
| 116 | 114 | if(isset($GLOBALS[$var]) && $var[0] == '_') { // extract($this->sharedVars, EXTR_OVERWRITE) and $$var = $value do not overwrites global vars |
| 117 | 115 | $GLOBALS[$var] = $value; |
| 118 | - } |
|
| 119 | - elseif(!isset($$var)) { |
|
| 116 | + } elseif(!isset($$var)) { |
|
| 120 | 117 | $$var = $value; |
| 121 | 118 | } |
| 122 | 119 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @param string|null $file |
| 175 | 175 | * @param int|null $line |
| 176 | 176 | * @param null $context |
| 177 | - * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore |
|
| 177 | + * @param integer $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore |
|
| 178 | 178 | */ |
| 179 | 179 | public function handleError($code = null, $text = null, $file = null, $line = null, $context = null, $ignoreTraceCalls = 0) { |
| 180 | 180 | if(!$this->isStarted || error_reporting() === 0 || $this->isHandlingDisabled() || ($this->errorsHandlerLevel && !($code & $this->errorsHandlerLevel))) { |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | * Handle debug data |
| 239 | 239 | * @param mixed $data |
| 240 | 240 | * @param string|null $tags Tags separated by dot, e.g. "low.db.billing" |
| 241 | - * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore |
|
| 241 | + * @param integer $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore |
|
| 242 | 242 | */ |
| 243 | 243 | public function debug($data, $tags = null, $ignoreTraceCalls = 0) { |
| 244 | 244 | if($this->connector->isActiveClient()) { |
@@ -224,11 +224,9 @@ |
||
| 224 | 224 | if($this->oldExceptionsHandler && $this->callOldHandlers) { |
| 225 | 225 | call_user_func($this->oldExceptionsHandler, $exception); |
| 226 | 226 | } |
| 227 | - } |
|
| 228 | - catch(\Throwable $internalException) { |
|
| 227 | + } catch(\Throwable $internalException) { |
|
| 229 | 228 | $this->handleException($internalException); |
| 230 | - } |
|
| 231 | - catch(\Exception $internalException) { |
|
| 229 | + } catch(\Exception $internalException) { |
|
| 232 | 230 | $this->handleException($internalException); |
| 233 | 231 | } |
| 234 | 232 | $this->onHandlingComplete(); |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | * Analog of Handler::getInstance()->debug(...) method |
| 87 | 87 | * @param mixed $data |
| 88 | 88 | * @param string|null $tags Tags separated by dot, e.g. "low.db.billing" |
| 89 | - * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore |
|
| 89 | + * @param integer $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore |
|
| 90 | 90 | */ |
| 91 | 91 | public static function debug($data, $tags = null, $ignoreTraceCalls = 0) { |
| 92 | 92 | if(self::$isActive) { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * @param Connector|null $connector |
| 44 | 44 | * @param Dumper|null $contextDumper |
| 45 | - * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore |
|
| 45 | + * @param integer $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore |
|
| 46 | 46 | */ |
| 47 | 47 | public function __construct(Connector $connector = null, Dumper $contextDumper = null, $ignoreTraceCalls = 1) { |
| 48 | 48 | $this->connector = $connector ?: Connector::getInstance(); |
@@ -76,6 +76,9 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | + /** |
|
| 80 | + * @param string $message |
|
| 81 | + */ |
|
| 79 | 82 | protected function fetchMessageContext($message, array $context) { |
| 80 | 83 | $replace = array(); |
| 81 | 84 | foreach($context as $key => $value) { |
@@ -62,16 +62,13 @@ |
||
| 62 | 62 | |
| 63 | 63 | if(isset(static::$debugLevels[$level])) { |
| 64 | 64 | $this->connector->getDebugDispatcher()->dispatchDebug($message, static::$debugLevels[$level], $this->ignoreTraceCalls); |
| 65 | - } |
|
| 66 | - elseif(isset(static::$errorsLevels[$level])) { |
|
| 65 | + } elseif(isset(static::$errorsLevels[$level])) { |
|
| 67 | 66 | if(isset($context['exception']) && ($context['exception'] instanceof \Exception || $context['exception'] instanceof \Throwable)) { |
| 68 | 67 | $this->connector->getErrorsDispatcher()->dispatchException($context['exception']); |
| 69 | - } |
|
| 70 | - else { |
|
| 68 | + } else { |
|
| 71 | 69 | $this->connector->getErrorsDispatcher()->dispatchError(static::$errorsLevels[$level], $message, null, null, $this->ignoreTraceCalls); |
| 72 | 70 | } |
| 73 | - } |
|
| 74 | - else { |
|
| 71 | + } else { |
|
| 75 | 72 | throw new InvalidArgumentException('Unknown log level "' . $level . '"'); |
| 76 | 73 | } |
| 77 | 74 | } |
@@ -89,11 +89,9 @@ |
||
| 89 | 89 | foreach($call['args'] as $arg) { |
| 90 | 90 | if(is_object($arg)) { |
| 91 | 91 | $args[] = get_class($arg); |
| 92 | - } |
|
| 93 | - elseif(is_array($arg)) { |
|
| 92 | + } elseif(is_array($arg)) { |
|
| 94 | 93 | $args[] = 'Array[' . count($arg) . ']'; |
| 95 | - } |
|
| 96 | - else { |
|
| 94 | + } else { |
|
| 97 | 95 | $arg = var_export($arg, 1); |
| 98 | 96 | $args[] = strlen($arg) > 15 ? substr($arg, 0, 15) . '...\'' : $arg; |
| 99 | 97 | } |