Helper: parse PHP and check if an update is needed at the given offset.
(php: &str, offset: u32)
| 1366 | |
| 1367 | /// Helper: parse PHP and check if an update is needed at the given offset. |
| 1368 | fn find_info(php: &str, offset: u32) -> Option<FunctionWithDocblock> { |
| 1369 | let arena = Bump::new(); |
| 1370 | let file_id = mago_database::file::FileId::new("input.php"); |
| 1371 | let program = mago_syntax::parser::parse_file_content(&arena, file_id, php); |
| 1372 | let ctx = find_cursor_context(&program.statements, offset); |
| 1373 | find_function_with_docblock_from_context( |
| 1374 | &ctx, |
| 1375 | &program.statements, |
| 1376 | program.trivia.as_slice(), |
| 1377 | php, |
| 1378 | offset, |
| 1379 | ) |
| 1380 | } |
| 1381 | |
| 1382 | /// Stub class loader that never resolves anything (for unit tests). |
| 1383 | fn no_class_loader() -> impl Fn(&str) -> Option<Arc<ClassInfo>> { |