phpAppendedPath (#3298): the path string literals (and `DIRECTORY_SEPARATOR`, read as `/`) append to a directory. It starts with `/`, doesn't end with one, and has no empty segment; None when anything else is appended.
(&self, tail: &[Node<'t>])
| 1030 | /// with `/`, doesn't end with one, and has no empty segment; None when |
| 1031 | /// anything else is appended. |
| 1032 | fn php_appended_path(&self, tail: &[Node<'t>]) -> Option<String> { |
| 1033 | let mut rest = String::new(); |
| 1034 | for part in tail { |
| 1035 | if let Some(literal) = self.php_literal_text(*part) { |
| 1036 | rest.push_str(literal); |
| 1037 | continue; |
| 1038 | } |
| 1039 | let text = self.text(*part); |
| 1040 | if text.strip_prefix('\\').unwrap_or(text) == "DIRECTORY_SEPARATOR" { |
| 1041 | rest.push('/'); |
| 1042 | } else { |
| 1043 | return None; |
| 1044 | } |
| 1045 | } |
| 1046 | if !rest.starts_with('/') || rest.ends_with('/') { |
| 1047 | return None; |
| 1048 | } |
| 1049 | rest.split('/').skip(1).all(|seg| !seg.is_empty()).then_some(rest) |
| 1050 | } |
| 1051 | |
| 1052 | /// phpDirectoryIncludePath (#3298): `__DIR__ . '/inc/a.php'`, |
| 1053 | /// `dirname(__FILE__) . DIRECTORY_SEPARATOR . 'a.php'` — a path appended |
no test coverage detected