@@ -10,14 +10,17 @@ discard block |
||
| 10 | 10 | $vendorDir = dirname(dirname($vendorDir)); |
| 11 | 11 | $vendorID = null; |
| 12 | 12 | $vendorCount = 0; |
| 13 | -foreach ($stacktrace as $index => $trace) { |
|
| 13 | +foreach ($stacktrace as $index => $trace) |
|
| 14 | +{ |
|
| 14 | 15 | $args = []; |
| 15 | - if (isset($trace['args'])) { |
|
| 16 | + if (isset($trace['args'])) |
|
| 17 | + { |
|
| 16 | 18 | $args = $valueWrapper->wrap($trace['args']); |
| 17 | 19 | } |
| 18 | 20 | |
| 19 | 21 | $function = '<strong>' . $trace['function'] . '</strong>'; |
| 20 | - if (isset($trace['type']) && isset($trace['class'])) { |
|
| 22 | + if (isset($trace['type']) && isset($trace['class'])) |
|
| 23 | + { |
|
| 21 | 24 | $reflection = new ReflectionClass($trace['class']); |
| 22 | 25 | $function = sprintf( |
| 23 | 26 | '<span title="%s">%s</span>%s%s', |
@@ -28,7 +31,9 @@ discard block |
||
| 28 | 31 | ); |
| 29 | 32 | } |
| 30 | 33 | |
| 31 | - if (!isset($trace['file']) || !file_exists($trace['file'])) { ?> |
|
| 34 | + if (!isset($trace['file']) || !file_exists($trace['file'])) |
|
| 35 | + { |
|
| 36 | +?> |
|
| 32 | 37 | <div class="container no-trace"> |
| 33 | 38 | <?= $function ?>(<span class="arguments"><?= implode(', ', $args) ?></span>) |
| 34 | 39 | </div> |
@@ -37,15 +42,21 @@ discard block |
||
| 37 | 42 | } |
| 38 | 43 | |
| 39 | 44 | $isVendor = strpos($trace['file'], $vendorDir) === 0 && $index > 1; |
| 40 | - if ($isVendor) { |
|
| 41 | - if ($vendorID === null) { |
|
| 45 | + if ($isVendor) |
|
| 46 | + { |
|
| 47 | + if ($vendorID === null) |
|
| 48 | + { |
|
| 42 | 49 | $vendorID = $index; |
| 43 | 50 | $vendorCount++; |
| 44 | 51 | echo sprintf('<span id="hidden-trace-%s" style="display: none;">', $vendorID); |
| 45 | - } else { |
|
| 52 | + } |
|
| 53 | + else |
|
| 54 | + { |
|
| 46 | 55 | $vendorCount++; |
| 47 | 56 | } |
| 48 | - } elseif ($vendorID !== null) { |
|
| 57 | + } |
|
| 58 | + elseif ($vendorID !== null) |
|
| 59 | + { |
|
| 49 | 60 | echo '</span>'; |
| 50 | 61 | echo sprintf( |
| 51 | 62 | '<div id="%s" class="container" style="cursor: pointer;" onclick="toggle(\'%s\'); toggle(\'%s\');">+ %s vendor frame(s)...</div>', |
@@ -72,6 +83,7 @@ discard block |
||
| 72 | 83 | <?php |
| 73 | 84 | } |
| 74 | 85 | |
| 75 | -if ($vendorID !== null) { |
|
| 86 | +if ($vendorID !== null) |
|
| 87 | +{ |
|
| 76 | 88 | echo '</span>'; |
| 77 | 89 | } |
@@ -24,19 +24,29 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function leaveNode(Node $node): void |
| 26 | 26 | { |
| 27 | - if ($node instanceof Node\Stmt\ClassMethod && $node->name->name === '__construct') { |
|
| 28 | - foreach ($node->params as $param) { |
|
| 29 | - if ($param->type instanceof Node\NullableType) { |
|
| 30 | - if ($param->type->type instanceof Node\Identifier) { |
|
| 27 | + if ($node instanceof Node\Stmt\ClassMethod && $node->name->name === '__construct') |
|
| 28 | + { |
|
| 29 | + foreach ($node->params as $param) |
|
| 30 | + { |
|
| 31 | + if ($param->type instanceof Node\NullableType) |
|
| 32 | + { |
|
| 33 | + if ($param->type->type instanceof Node\Identifier) |
|
| 34 | + { |
|
| 31 | 35 | $type = $param->type->type->name; |
| 32 | - } else { |
|
| 36 | + } |
|
| 37 | + else |
|
| 38 | + { |
|
| 33 | 39 | $type = implode('\\', $param->type->type->parts); |
| 34 | 40 | } |
| 35 | 41 | |
| 36 | 42 | $type = "?$type"; |
| 37 | - } elseif ($param->type instanceof Node\Name) { |
|
| 43 | + } |
|
| 44 | + elseif ($param->type instanceof Node\Name) |
|
| 45 | + { |
|
| 38 | 46 | $type = implode('\\', $param->type->parts); |
| 39 | - } else { |
|
| 47 | + } |
|
| 48 | + else |
|
| 49 | + { |
|
| 40 | 50 | $type = $param->type->name ?? null; |
| 41 | 51 | } |
| 42 | 52 | |
@@ -26,22 +26,28 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | $lines = explode("\n", $comment); |
| 28 | 28 | |
| 29 | - foreach ($lines as $line) { |
|
| 29 | + foreach ($lines as $line) |
|
| 30 | + { |
|
| 30 | 31 | // strip up comment prefix |
| 31 | 32 | $line = preg_replace('/[\t ]*[\/]?\*[\/]? ?/', '', $line); |
| 32 | 33 | |
| 33 | - if (preg_match('/ *@([^ ]+) (.*)/u', $line, $matches)) { |
|
| 34 | + if (preg_match('/ *@([^ ]+) (.*)/u', $line, $matches)) |
|
| 35 | + { |
|
| 34 | 36 | $this->lines[] = new Line($matches[2], $matches[1]); |
| 35 | - } else { |
|
| 37 | + } |
|
| 38 | + else |
|
| 39 | + { |
|
| 36 | 40 | $this->lines[] = new Line($line); |
| 37 | 41 | } |
| 38 | 42 | } |
| 39 | 43 | |
| 40 | - if (isset($this->lines[0]) && $this->lines[0]->isEmpty()) { |
|
| 44 | + if (isset($this->lines[0]) && $this->lines[0]->isEmpty()) |
|
| 45 | + { |
|
| 41 | 46 | array_shift($this->lines); |
| 42 | 47 | } |
| 43 | 48 | |
| 44 | - if (isset($this->lines[count($this->lines) - 1]) && $this->lines[count($this->lines) - 1]->isEmpty()) { |
|
| 49 | + if (isset($this->lines[count($this->lines) - 1]) && $this->lines[count($this->lines) - 1]->isEmpty()) |
|
| 50 | + { |
|
| 45 | 51 | array_pop($this->lines); |
| 46 | 52 | } |
| 47 | 53 | } |
@@ -55,8 +61,10 @@ discard block |
||
| 55 | 61 | $result[] = '/**'; |
| 56 | 62 | |
| 57 | 63 | // skip first and last tokens |
| 58 | - foreach ($this->lines as $line) { |
|
| 59 | - if ($line->type === null) { |
|
| 64 | + foreach ($this->lines as $line) |
|
| 65 | + { |
|
| 66 | + if ($line->type === null) |
|
| 67 | + { |
|
| 60 | 68 | $result[] = sprintf(' * %s', $line->value); |
| 61 | 69 | continue; |
| 62 | 70 | } |
@@ -28,8 +28,10 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function enterNode(Node $node) |
| 30 | 30 | { |
| 31 | - if ($node instanceof Node\Stmt\Use_) { |
|
| 32 | - foreach ($node->uses as $use) { |
|
| 31 | + if ($node instanceof Node\Stmt\Use_) |
|
| 32 | + { |
|
| 33 | + foreach ($node->uses as $use) |
|
| 34 | + { |
|
| 33 | 35 | $this->imports[] = [ |
| 34 | 36 | 'name' => implode('\\', $use->name->parts), |
| 35 | 37 | 'alias' => !empty($use->alias) ? $use->alias->name : null, |
@@ -37,9 +39,12 @@ discard block |
||
| 37 | 39 | } |
| 38 | 40 | } |
| 39 | 41 | |
| 40 | - if ($node instanceof Node\Stmt\Class_) { |
|
| 41 | - foreach ($node->stmts as $stmt) { |
|
| 42 | - if ($stmt instanceof Node\Stmt\ClassMethod && $stmt->name === '__construct') { |
|
| 42 | + if ($node instanceof Node\Stmt\Class_) |
|
| 43 | + { |
|
| 44 | + foreach ($node->stmts as $stmt) |
|
| 45 | + { |
|
| 46 | + if ($stmt instanceof Node\Stmt\ClassMethod && $stmt->name === '__construct') |
|
| 47 | + { |
|
| 43 | 48 | return $stmt; |
| 44 | 49 | } |
| 45 | 50 | } |
@@ -26,11 +26,13 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public function enterNode(Node $node) |
| 28 | 28 | { |
| 29 | - if ($node instanceof Node\Stmt\Namespace_) { |
|
| 29 | + if ($node instanceof Node\Stmt\Namespace_) |
|
| 30 | + { |
|
| 30 | 31 | $this->namespace = implode('\\', $node->name->parts); |
| 31 | 32 | } |
| 32 | 33 | |
| 33 | - if ($node instanceof Node\Stmt\Class_) { |
|
| 34 | + if ($node instanceof Node\Stmt\Class_) |
|
| 35 | + { |
|
| 34 | 36 | $this->class = $node->name->name; |
| 35 | 37 | |
| 36 | 38 | return NodeTraverser::STOP_TRAVERSAL; |
@@ -28,12 +28,15 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function leaveNode(Node $node) |
| 30 | 30 | { |
| 31 | - if (!$node instanceof Node\Stmt\TraitUse) { |
|
| 31 | + if (!$node instanceof Node\Stmt\TraitUse) |
|
| 32 | + { |
|
| 32 | 33 | return null; |
| 33 | 34 | } |
| 34 | 35 | |
| 35 | - foreach ($node->traits as $index => $use) { |
|
| 36 | - if ($use instanceof Node\Name) { |
|
| 36 | + foreach ($node->traits as $index => $use) |
|
| 37 | + { |
|
| 38 | + if ($use instanceof Node\Name) |
|
| 39 | + { |
|
| 37 | 40 | $name = $this->trimSlashes(implode('\\', $use->parts)); |
| 38 | 41 | if ( |
| 39 | 42 | in_array($name, [ |
@@ -47,7 +50,8 @@ discard block |
||
| 47 | 50 | } |
| 48 | 51 | |
| 49 | 52 | $node->traits = array_values($node->traits); |
| 50 | - if (empty($node->traits)) { |
|
| 53 | + if (empty($node->traits)) |
|
| 54 | + { |
|
| 51 | 55 | return NodeTraverser::REMOVE_NODE; |
| 52 | 56 | } |
| 53 | 57 | |