File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ abstract class CodeScanner extends Scanner
1414{
1515 protected $ ignoreInvalidFunctions = false ;
1616
17+ protected $ addReferences = true ;
18+
1719 protected $ commentsPrefixes = [];
1820
1921 protected $ functions = [
@@ -63,6 +65,13 @@ public function ignoreInvalidFunctions($ignore = true): self
6365 return $ this ;
6466 }
6567
68+ public function addReferences ($ enabled = true ): self
69+ {
70+ $ this ->addReferences = $ enabled ;
71+
72+ return $ this ;
73+ }
74+
6675 public function extractCommentsStartingWith (string ...$ prefixes ): self
6776 {
6877 $ this ->commentsPrefixes = $ prefixes ;
@@ -93,7 +102,7 @@ protected function handleFunction(ParsedFunction $function)
93102
94103 $ translation = call_user_func ([$ this , $ handler ], $ function );
95104
96- if ($ translation ) {
105+ if ($ translation && $ this -> addReferences ) {
97106 $ translation ->getReferences ()->add ($ function ->getFilename (), $ function ->getLine ());
98107 }
99108 }
You can’t perform that action at this time.
0 commit comments