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

Function is_removed_for_version

src/parser/mod.rs:152–164  ·  view source on GitHub ↗

Check whether a function, method, or class has been removed in the target PHP version based on a `@removed X.Y` docblock tag. Returns `true` when the element has `@removed X.Y` and the target PHP version is >= X.Y (meaning it was removed before or at the target version). Returns `false` when there is no `@removed` tag or the target version is older than the removal version.

(
    node: &impl HasSpan,
    ctx: &DocblockCtx<'_>,
    php_version: PhpVersion,
)

Source from the content-addressed store, hash-verified

150/// Returns `false` when there is no `@removed` tag or the target
151/// version is older than the removal version.
152pub(crate) fn is_removed_for_version(
153 node: &impl HasSpan,
154 ctx: &DocblockCtx<'_>,
155 php_version: PhpVersion,
156) -> bool {
157 let docblock_text = crate::docblock::get_docblock_text_for_node(ctx.trivias, ctx.content, node);
158 if let Some(text) = docblock_text
159 && let Some(removed_ver) = crate::docblock::extract_removed_version(text)
160 {
161 return php_version >= removed_ver;
162 }
163 false
164}
165
166/// Check whether a parameter is available for the given PHP version
167/// based on its `#[PhpStormStubsElementAvailable]` attributes.

Calls 2

extract_removed_versionFunction · 0.85

Tested by

no test coverage detected