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>])
| 1044 | /// with `/`, doesn't end with one, and has no empty segment; None when |
| 1045 | /// anything else is appended. |
| 1046 | fn php_appended_path(&self, tail: &[Node<'t>]) -> Option<String> { |
| 1047 | let mut rest = String::new(); |
| 1048 | for part in tail { |
| 1049 | if let Some(literal) = self.php_literal_text(*part) { |
| 1050 | rest.push_str(literal); |
| 1051 | continue; |
| 1052 | } |
| 1053 | let text = self.text(*part); |
| 1054 | if text.strip_prefix('\\').unwrap_or(text) == "DIRECTORY_SEPARATOR" { |
| 1055 | rest.push('/'); |
| 1056 | } else { |
| 1057 | return None; |
| 1058 | } |
| 1059 | } |
| 1060 | if !rest.starts_with('/') || rest.ends_with('/') { |
| 1061 | return None; |
| 1062 | } |
| 1063 | rest.split('/').skip(1).all(|seg| !seg.is_empty()).then_some(rest) |
| 1064 | } |
| 1065 | |
| 1066 | /// phpDirectoryIncludePath (#3298): `__DIR__ . '/inc/a.php'`, |
| 1067 | /// `dirname(__FILE__) . DIRECTORY_SEPARATOR . 'a.php'` — a path appended |
no test coverage detected