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

Function lacks_docblock_override

src/inheritance.rs:105–117  ·  view source on GitHub ↗

Whether a child's effective type equals its native type, meaning no docblock override was applied. Returns `true` when the child wrote no `@return` / `@var` / `@param` tag (so the effective type is just the native hint). Returns `false` when the child provided its own docblock type — in that case the child's type is an intentional override and should not be replaced.

(effective: &Option<PhpType>, native: &Option<PhpType>)

Source from the content-addressed store, hash-verified

103/// when the child provided its own docblock type — in that case the
104/// child's type is an intentional override and should not be replaced.
105fn lacks_docblock_override(effective: &Option<PhpType>, native: &Option<PhpType>) -> bool {
106 match (effective, native) {
107 // No effective type at all — nothing to override.
108 (None, _) => true,
109 // Effective type present but no native type — the child wrote
110 // a docblock-only type (e.g. `@return list<Pen>` with no native
111 // hint). That is an intentional override.
112 (Some(_), None) => false,
113 // Both present — if they are equivalent, the child didn't write
114 // a docblock (the effective type is just the native hint echoed).
115 (Some(eff), Some(nat)) => eff.equivalent(nat),
116 }
117}
118
119/// Whether an ancestor's type is richer than the child's native type.
120///

Callers 3

enrich_single_parameterFunction · 0.85

Calls 1

equivalentMethod · 0.80

Tested by

no test coverage detected