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

Function is_param_available_for_version

src/parser/mod.rs:171–181  ·  view source on GitHub ↗

Check whether a parameter is available for the given PHP version based on its `#[PhpStormStubsElementAvailable]` attributes. Same logic as [`is_available_for_version`] but operates on a single parameter's attribute lists.

(
    param: &function_like::parameter::FunctionLikeParameter<'_>,
    ctx: &DocblockCtx<'_>,
    php_version: PhpVersion,
)

Source from the content-addressed store, hash-verified

169/// Same logic as [`is_available_for_version`] but operates on a single
170/// parameter's attribute lists.
171pub(crate) fn is_param_available_for_version(
172 param: &function_like::parameter::FunctionLikeParameter<'_>,
173 ctx: &DocblockCtx<'_>,
174 php_version: PhpVersion,
175) -> bool {
176 if let Some(avail) = extract_version_availability(&param.attribute_lists, ctx) {
177 php_version.matches_range(avail.from, avail.to)
178 } else {
179 true
180 }
181}
182
183/// Extract the `from` / `to` version range from a
184/// `#[PhpStormStubsElementAvailable(...)]` attribute, if present.

Callers 1

extract_parametersFunction · 0.85

Calls 2

matches_rangeMethod · 0.80

Tested by

no test coverage detected