Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Mar 11, 2024
1 parent 7a494ce commit 30cba8e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/services/HintsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,7 @@ protected function createHintWithTemplateLine(FieldInterface $field): ?HintModel
'stackTrace' => [$templatePath . ':' . $line],
]);
} else {
if ($template->getParent([]) !== null) {
$hint->stackTrace[] = $templatePath . ':' . $line;
}
$hint->stackTrace[] = $templatePath . ':' . $line;

continue;
}
Expand All @@ -265,7 +263,7 @@ protected function createHintWithTemplateLine(FieldInterface $field): ?HintModel
// be retrieved from the source context with `devMode` disabled.
$templateCode = file($this->_getTemplatePath($template));
$code = $templateCode[$line - 1] ?? '';
preg_match('/([\w]+?)\.' . $field->handle . '/', $code, $matches);
preg_match('/(\w+?)\.' . $field->handle . '/', $code, $matches);
$routeVariable = $matches[1] ?? null;

if ($routeVariable && !empty($trace['args'][0]['variables'][$routeVariable])) {
Expand Down

0 comments on commit 30cba8e

Please sign in to comment.