MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / eq_ignore_case_snake

Function eq_ignore_case_snake

src/inlay_hints.rs:514–530  ·  view source on GitHub ↗

Compare two identifiers ignoring case and treating snake_case as equivalent to camelCase. For example, `eq_ignore_case_snake("myParam", "my_param")` returns true.

(a: &str, b: &str)

Source from the content-addressed store, hash-verified

512///
513/// For example, `eq_ignore_case_snake("myParam", "my_param")` returns true.
514fn eq_ignore_case_snake(a: &str, b: &str) -> bool {
515 if a.eq_ignore_ascii_case(b) {
516 return true;
517 }
518 // Normalize both to lowercase without underscores and compare.
519 let norm_a: String = a
520 .chars()
521 .filter(|c| *c != '_')
522 .flat_map(|c| c.to_lowercase())
523 .collect();
524 let norm_b: String = b
525 .chars()
526 .filter(|c| *c != '_')
527 .flat_map(|c| c.to_lowercase())
528 .collect();
529 norm_a == norm_b
530}
531
532/// Check whether a single-parameter call has an obvious relationship
533/// between the function/method name and the parameter, making the hint

Callers 1

should_suppress_hintFunction · 0.85

Calls 1

filterMethod · 0.80

Tested by

no test coverage detected