diff --git a/src/Scanner/CodeScanner.php b/src/Scanner/CodeScanner.php index c84b0dbc..fccaf2aa 100644 --- a/src/Scanner/CodeScanner.php +++ b/src/Scanner/CodeScanner.php @@ -14,6 +14,8 @@ abstract class CodeScanner extends Scanner { protected $ignoreInvalidFunctions = false; + protected $addReferences = true; + protected $commentsPrefixes = []; protected $functions = [ @@ -63,6 +65,13 @@ public function ignoreInvalidFunctions($ignore = true): self return $this; } + public function addReferences($enabled = true): self + { + $this->addReferences = $enabled; + + return $this; + } + public function extractCommentsStartingWith(string ...$prefixes): self { $this->commentsPrefixes = $prefixes; @@ -93,7 +102,7 @@ protected function handleFunction(ParsedFunction $function) $translation = call_user_func([$this, $handler], $function); - if ($translation) { + if ($translation && $this->addReferences) { $translation->getReferences()->add($function->getFilename(), $function->getLine()); } }