Version-aware variant of [`parse_functions`]. When `php_version` is `Some`, functions and parameters annotated with `#[PhpStormStubsElementAvailable]` whose version range excludes the target version are filtered out.
(
&self,
content: &str,
php_version: Option<PhpVersion>,
)
| 1151 | /// with `#[PhpStormStubsElementAvailable]` whose version range |
| 1152 | /// excludes the target version are filtered out. |
| 1153 | pub fn parse_functions_versioned( |
| 1154 | &self, |
| 1155 | content: &str, |
| 1156 | php_version: Option<PhpVersion>, |
| 1157 | ) -> Vec<FunctionInfo> { |
| 1158 | with_parsed_program(content, "parse_functions", |program, content| { |
| 1159 | let mut use_map = HashMap::new(); |
| 1160 | Self::extract_use_statements_from_statements(program.statements.iter(), &mut use_map); |
| 1161 | let namespace = Self::extract_namespace_from_statements(program.statements.iter()); |
| 1162 | |
| 1163 | let doc_ctx = DocblockCtx { |
| 1164 | trivias: program.trivia.as_slice(), |
| 1165 | content, |
| 1166 | php_version, |
| 1167 | use_map, |
| 1168 | namespace, |
| 1169 | }; |
| 1170 | |
| 1171 | let mut functions = Vec::new(); |
| 1172 | Self::extract_functions_from_statements( |
| 1173 | program.statements.iter(), |
| 1174 | &mut functions, |
| 1175 | &None, |
| 1176 | Some(&doc_ctx), |
| 1177 | ); |
| 1178 | functions |
| 1179 | }) |
| 1180 | } |
| 1181 | |
| 1182 | /// Parse PHP source text and extract constant names from `define()` calls |
| 1183 | /// and top-level `const` statements. |