diff --git a/src/Command/Lint.php b/src/Command/Lint.php index bce91941..8f19f9df 100644 --- a/src/Command/Lint.php +++ b/src/Command/Lint.php @@ -19,6 +19,7 @@ use Symfony\Component\Finder\Finder; use Twig\Error\Error; use Twig\Error\LoaderError; +use Twig\Source; /** * Artisan command to check the syntax of Twig templates. @@ -329,15 +330,15 @@ protected function renderException(array $info) /** * Grabs the surrounding lines around the exception. * - * @param string $template Contents of Twig template. - * @param string|int $line Line where the exception occurred. - * @param int $context Number of lines around the line where the exception occurred. + * @param \Twig\Source $template Contents of Twig template. + * @param string|int $line Line where the exception occurred. + * @param int $context Number of lines around the line where the exception occurred. * * @return array */ - protected function getContext($template, $line, $context = 3) + protected function getContext(Source $template, $line, $context = 3) { - $lines = explode("\n", $template); + $lines = explode("\n", $template->getCode()); $position = max(0, $line - $context); $max = min(count($lines), $line - 1 + $context);