File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 19
19
use Symfony \Component \Finder \Finder ;
20
20
use Twig \Error \Error ;
21
21
use Twig \Error \LoaderError ;
22
+ use Twig \Source ;
22
23
23
24
/**
24
25
* Artisan command to check the syntax of Twig templates.
@@ -329,15 +330,15 @@ protected function renderException(array $info)
329
330
/**
330
331
* Grabs the surrounding lines around the exception.
331
332
*
332
- * @param string $template Contents of Twig template.
333
- * @param string|int $line Line where the exception occurred.
334
- * @param int $context Number of lines around the line where the exception occurred.
333
+ * @param \Twig\Source $template Contents of Twig template.
334
+ * @param string|int $line Line where the exception occurred.
335
+ * @param int $context Number of lines around the line where the exception occurred.
335
336
*
336
337
* @return array
337
338
*/
338
- protected function getContext ($ template , $ line , $ context = 3 )
339
+ protected function getContext (Source $ template , $ line , $ context = 3 )
339
340
{
340
- $ lines = explode ("\n" , $ template );
341
+ $ lines = explode ("\n" , $ template-> getCode () );
341
342
$ position = max (0 , $ line - $ context );
342
343
$ max = min (count ($ lines ), $ line - 1 + $ context );
343
344
You can’t perform that action at this time.
0 commit comments