The File node at exactly `rel_path`, or NULL. Looked up through the name * index (File nodes are named by basename) and matched on the full path, so * a same-named file in another directory never qualifies. */
| 2095 | * index (File nodes are named by basename) and matched on the full path, so |
| 2096 | * a same-named file in another directory never qualifies. */ |
| 2097 | static const cbm_gbuf_node_t *psr4_file_node(const cbm_gbuf_t *gbuf, const char *rel_path) { |
| 2098 | const cbm_gbuf_node_t **hits = NULL; |
| 2099 | int hit_count = 0; |
| 2100 | if (cbm_gbuf_find_by_name(gbuf, path_leaf(rel_path), &hits, &hit_count) != 0 || !hits) { |
| 2101 | return NULL; |
| 2102 | } |
| 2103 | for (int i = 0; i < hit_count; i++) { |
| 2104 | const cbm_gbuf_node_t *n = hits[i]; |
| 2105 | if (n && n->label && strcmp(n->label, "File") == 0 && n->file_path && |
| 2106 | strcmp(n->file_path, rel_path) == 0) { |
| 2107 | return n; |
| 2108 | } |
| 2109 | } |
| 2110 | return NULL; |
| 2111 | } |
| 2112 | |
| 2113 | /* Resolve a PHP class import `use A\B\C;` the way composer's PSR-4 autoloader |
| 2114 | * does: for every autoload.psr-4 prefix covering the name, longest first, the |
no test coverage detected