module

Noir::PhpCalleeExtractor

Inherits Noir::CalleeExtractorBase

Constants

BARE_CALL_REGEX = /(?<![>\w:$\\])(\\?[A-Za-z_]\w*(?:\\[A-Za-z_]\w*)*)\s*\(/
CLASS_PROPERTY_CALL_REGEX = /(\\?[A-Za-z_]\w*(?:\\[A-Za-z_]\w*)*::\$\w+(?:\s*->\s*[A-Za-z_]\w*\s*(?:\(\s*\))?)*\s*->\s*[A-Za-z_]\w*)\s*\(/
OBJECT_CALL_REGEX = /(?<!:)(\$[A-Za-z_]\w*(?:\s*->\s*[A-Za-z_]\w*\s*(?:\(\s*\))?)*\s*->\s*[A-Za-z_]\w*)\s*\(/
RESERVED = Set {"array", "catch", "class", "clone", "declare", "die", "echo", "elseif", "empty", "eval", "exit", "fn", "for", "foreach", "function", "global", "if", "include", "include_once", "isset", "list", "match", "print", "require", "require_once", "return", "static", "switch", "throw", "trait", "try", "unset", "use", "while"}
STATIC_CALL_REGEX = /(\\?[A-Za-z_]\w*(?:\\[A-Za-z_]\w*)*(?:::[A-Za-z_]\w*)+)\s*\(/

Instance methods

callees_for_body(body : String, file_path : String, start_line : Int32, php_mode : Bool = true) : Array(Entry)

body is a fragment of PHP code (a method or closure body) unless php_mode is false, for a whole file that may open with markup.

Source
strip_comments(content : String) : String

content with //, # and /* */ comments (docblocks too) blanked, string literals and #[Attribute]s kept, and every line in place.

Source