Skip to content

Don't make ParsedFunction final (or introduce a couple of additional getter/setter) #255

@drzraf

Description

@drzraf

It would be handy to define a parsedFunction in two steps. And particularly to change it's name after some interpolation and arguments identification has been done.
(Sample use-case: I've two functions mapping to dngettext)

Scanner pseudo-code:

public function scan(string $code, string $filename): array
   $found_functions = $this->foo();
   // Now create parsedFunctions[]
   foreach ($found_functions as $function) {
       list($name, $line, $args) = $function;
       $p = new ParsedFunction($name, $filename, $line); // factor this line of code since it always happens

       switch ($name) { // prepare with parsedFunction **arguments**
           // ... but may need to actually change ParsedFunction's $name
       }
   }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions