Check whether a function or method is available for the given PHP version based on its `#[PhpStormStubsElementAvailable]` attributes. Returns `true` when: - The element has no `PhpStormStubsElementAvailable` attribute (always available). - The element has the attribute and the version falls within its range. Returns `false` when the attribute is present and the version is outside the range.
(
attribute_lists: &Sequence<'_, attribute::AttributeList<'_>>,
ctx: &DocblockCtx<'_>,
php_version: PhpVersion,
)
| 128 | /// |
| 129 | /// Returns `false` when the attribute is present and the version is outside the range. |
| 130 | pub(crate) fn is_available_for_version( |
| 131 | attribute_lists: &Sequence<'_, attribute::AttributeList<'_>>, |
| 132 | ctx: &DocblockCtx<'_>, |
| 133 | php_version: PhpVersion, |
| 134 | ) -> bool { |
| 135 | if let Some(avail) = extract_version_availability(attribute_lists, ctx) { |
| 136 | php_version.matches_range(avail.from, avail.to) |
| 137 | } else { |
| 138 | // No version attribute → always available. |
| 139 | true |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | /// Check whether a function, method, or class has been removed in the |
| 144 | /// target PHP version based on a `@removed X.Y` docblock tag. |
no test coverage detected