Extract the trailing identifier from a member-access expression. For `$this->foo->bar`, returns `"bar"`. For `SomeClass::method`, returns `"method"`.
(text: &str)
| 495 | /// For `$this->foo->bar`, returns `"bar"`. |
| 496 | /// For `SomeClass::method`, returns `"method"`. |
| 497 | fn extract_trailing_identifier(text: &str) -> Option<&str> { |
| 498 | let trimmed = text.trim(); |
| 499 | // Look for `->identifier` or `::identifier` at the end. |
| 500 | let pos = trimmed.rfind("->").or_else(|| trimmed.rfind("::"))?; |
| 501 | let after = &trimmed[pos + 2..]; |
| 502 | // The trailing part should be a simple identifier. |
| 503 | if after.chars().all(|c| c.is_alphanumeric() || c == '_') && !after.is_empty() { |
| 504 | Some(after) |
| 505 | } else { |
| 506 | None |
| 507 | } |
| 508 | } |
| 509 | |
| 510 | /// Compare two identifiers ignoring case and treating snake_case |
| 511 | /// as equivalent to camelCase. |
no test coverage detected