Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Resources/templates/htmlTable.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,15 @@
<tr class="violation">
<td class="index"><?php echo $index++; ?></td>
<td class="usage"><?php echo strip_tags($violation['message']); ?></td>
<td class="line"><?php echo $violation['line'] ?></td>
<td class="line">
<?php if (isset($violation['link'])): ?>
<a href="<?php echo $violation['link'] ?>">
<?php echo $violation['line'] ?>
</a>
<?php else: ?>
<?php echo $violation['line'] ?>
<?php endif ?>
</td>
<td class="comment"><?php echo $violation['comment'] ?></td>
</tr>
<?php endforeach; ?>
Expand Down
8 changes: 8 additions & 0 deletions src/Violation/Renderer/Html/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class Renderer implements RendererInterface
* @var Filesystem
*/
private $fileSystem;
/**
* @var string
*/
private $fileLinkFormat;

/**
* @param MessageHelper $messageHelper
Expand All @@ -44,6 +48,7 @@ public function __construct(
$this->messageHelper = $messageHelper;
$this->fileSystem = $filesystem;
$this->outputFilename = $outputFilename;
$this->fileLinkFormat = ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
}

/**
Expand All @@ -63,6 +68,9 @@ public function renderViolations(array $violations, array $errors)
$fileViolation['message'] = $this->messageHelper->getViolationMessage($violation);
$fileViolation['line'] = $violation->getLine();
$fileViolation['comment'] = $violation->getComment();
if ($this->fileLinkFormat) {
$fileViolation['link'] = strtr($this->fileLinkFormat, array('%f' => $key, '%l' => $fileViolation['line']));
}
$orderedViolations[$key][] = $fileViolation;
}

Expand Down