Skip to content

Commit

Permalink
RoutingPanel: show presenter class even if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Apr 20, 2024
1 parent 97f3280 commit 0af99e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/Bridges/ApplicationTracy/RoutingPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,16 @@ private function analyse(Routing\RouteList $router, ?Nette\Http\IRequest $httpRe
}


private function findSource(): \ReflectionClass|\ReflectionMethod|null
private function findSource(): \ReflectionClass|\ReflectionMethod|string|null
{
$params = $this->matched;
$presenter = $params['presenter'] ?? '';
try {
$class = $this->presenterFactory->getPresenterClass($presenter);
} catch (Nette\Application\InvalidPresenterException) {
if ($this->presenterFactory instanceof Nette\Application\PresenterFactory) {
return $this->presenterFactory->formatPresenterClass($presenter);
}
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ use Tracy\Helpers;
<p><code><?= Helpers::escapeHtml($method) ?></code>
<code><?= Helpers::escapeHtml($url->getBaseUrl()) ?><wbr><span class="nette-RoutingPanel-rel"><?= str_replace(['&amp;', '?'], ['<wbr>&amp;', '<wbr>?'], Helpers::escapeHtml($url->getRelativeUrl())) ?></span></code></p>

<?php if ($source): ?>
<p><a href="<?= Helpers::escapeHtml(Tracy\Helpers::editorUri($source->getFileName(), $source->getStartLine())) ?>"><?= $source instanceof \ReflectionClass ? $source->getName() : $source->getDeclaringClass()->getName() . '::' . $source->getName() . '()' ?></a></p>
<?php if (is_string($source)): ?>
<p><?= Helpers::escapeHtml($source) ?> (class not found)</p>
<?php elseif ($source): ?>
<p><a href="<?= Helpers::escapeHtml(Tracy\Helpers::editorUri($source->getFileName(), $source->getStartLine())) ?>"><?= $source instanceof \ReflectionClass ? $source->getName() : $source->getDeclaringClass()->getName() . '::' . $source->getName() . '()' ?></a></p>
<?php endif ?>
</div>

Expand Down

0 comments on commit 0af99e2

Please sign in to comment.