Skip to content

Commit b13e278

Browse files
authored
Do not run the Twig worker if we are not extracting, (#115)
1 parent 7019d57 commit b13e278

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Visitor/Twig/TwigVisitor.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ public static function create()
5858
*/
5959
protected function doEnterNode($node)
6060
{
61+
// If not initialized
62+
if (null === $this->collection) {
63+
// We have not executed BaseVisitor::init which means that we are not currently extracting
64+
return $node;
65+
}
66+
6167
return $this->worker->work($node, $this->collection, function () {
6268
return $this->getAbsoluteFilePath();
6369
});

0 commit comments

Comments
 (0)