Build a `namespace Foo;\n` line for use inside PHP code blocks. Returns an empty string when the namespace is global (None).
(namespace: Option<&str>)
| 103 | /// Build a `namespace Foo;\n` line for use inside PHP code blocks. |
| 104 | /// Returns an empty string when the namespace is global (None). |
| 105 | pub(super) fn namespace_line(namespace: Option<&str>) -> String { |
| 106 | if let Some(ns) = namespace |
| 107 | && !ns.is_empty() |
| 108 | && !ns.starts_with("___") |
| 109 | { |
| 110 | format!("namespace {};\n", ns) |
| 111 | } else { |
| 112 | String::new() |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | /// Build a `@var` docblock annotation when the effective type differs from |
| 117 | /// the native type. Returns `None` when they are identical or when there |
no test coverage detected