dynamic rules @filter should work like phpgrep CLI filters.
What should be changed:
There should be no restrictions on the variable expression. ${"x:const"} should work as well as $x; the :const part specifies the node class
When matching, $x with a filter should not be limited to variables; $x matches anything in phpgrep. Instead of matching by variable name after a type assertion, a text slice should be taken using the $x node position info (it has begin+end positions). We usually have the current file source available during the analysis as []byte.
dynamic rules
@filter
should work likephpgrep
CLI filters.What should be changed:
${"x:const"}
should work as well as$x
; the:const
part specifies the node class$x
with a filter should not be limited to variables;$x
matches anything in phpgrep. Instead of matching by variable name after a type assertion, a text slice should be taken using the$x
node position info (it has begin+end positions). We usually have the current file source available during the analysis as[]byte
.