pub struct ParsedDocblock {Show 46 fields
pub params: Vec<(String, Type)>,
pub out_params: Vec<(String, Type)>,
pub return_type: Option<Type>,
pub var_type: Option<Type>,
pub var_name: Option<String>,
pub templates: Vec<(String, Option<Type>, Variance, Option<Type>)>,
pub extends: Vec<Type>,
pub implements: Vec<Type>,
pub uses: Vec<Type>,
pub throws: Vec<String>,
pub assertions: Vec<(String, Vec<ArrayKey>, Type, bool)>,
pub assertions_if_true: Vec<(String, Vec<ArrayKey>, Type, bool)>,
pub assertions_if_false: Vec<(String, Vec<ArrayKey>, Type, bool)>,
pub suppressed_issues: Vec<String>,
pub is_deprecated: bool,
pub is_internal: bool,
pub is_pure: bool,
pub is_mutation_free: bool,
pub is_external_mutation_free: bool,
pub no_named_arguments: bool,
pub is_immutable: bool,
pub is_readonly: bool,
pub is_api: bool,
pub is_final: bool,
pub is_inherit_doc: bool,
pub description: String,
pub deprecated: Option<String>,
pub see: Vec<String>,
pub mixins: Vec<String>,
pub properties: Vec<DocProperty>,
pub methods: Vec<DocMethod>,
pub type_aliases: Vec<DocTypeAlias>,
pub import_types: Vec<DocImportType>,
pub require_extends: Vec<String>,
pub require_implements: Vec<String>,
pub since: Option<String>,
pub removed: Option<String>,
pub invalid_annotations: Vec<String>,
pub mir_checks: Vec<(String, String)>,
pub trace_vars: Vec<String>,
pub taint_sinks: Vec<(String, String)>,
pub is_taint_source: bool,
pub seal_properties: bool,
pub if_this_is: Option<Type>,
pub self_out: Option<Type>,
pub data_providers: Vec<String>,
}Fields§
§params: Vec<(String, Type)>@param Type $name
out_params: Vec<(String, Type)>@param-out Type $name / @psalm-param-out Type $name — the type written
back to the caller’s by-ref argument after the call.
return_type: Option<Type>@return Type
var_type: Option<Type>@var Type or @var Type $name — type and optional variable name
var_name: Option<String>Optional variable name from @var Type $name
templates: Vec<(String, Option<Type>, Variance, Option<Type>)>@template T / @template T of Bound / @template-covariant T / @template-contravariant T
The last element is the optional @template T = Default default type.
extends: Vec<Type>@extends ClassName<T> — a class has at most one entry (its single
parent); an interface may have several, one per base interface named
in its native extends A, B clause.
implements: Vec<Type>@implements InterfaceName<T>
uses: Vec<Type>@use TraitName<T> — explicit type argument(s) for a used trait’s
own @template, mirroring @implements for interfaces.
throws: Vec<String>@throws ClassName
assertions: Vec<(String, Vec<ArrayKey>, Type, bool)>@psalm-assert Type $var — the bool is true for the !Type negated
form; the key path is non-empty when the target is a specific
(possibly nested) array key of $var (@psalm-assert Type $var['a']['b']) rather than the whole variable.
assertions_if_true: Vec<(String, Vec<ArrayKey>, Type, bool)>@psalm-assert-if-true Type $var
assertions_if_false: Vec<(String, Vec<ArrayKey>, Type, bool)>@psalm-assert-if-false Type $var
suppressed_issues: Vec<String>@psalm-suppress IssueName
is_deprecated: bool§is_internal: bool§is_pure: bool§is_mutation_free: bool§is_external_mutation_free: bool§no_named_arguments: bool§is_immutable: bool§is_readonly: bool§is_api: bool§is_final: bool@final — class should be treated as final even without the PHP final keyword.
is_inherit_doc: bool@inheritDoc or {@inheritDoc} was present — documentation should be
inherited from the nearest ancestor that has a real docblock.
description: StringFree text before first @ tag — used for hover display
deprecated: Option<String>@deprecated message — Some(message) or Some(“”) if no message
see: Vec<String>@see ClassName / @link URL
mixins: Vec<String>@mixin ClassName
properties: Vec<DocProperty>@property, @property-read, @property-write
methods: Vec<DocMethod>@method [static] ReturnType name([params])
type_aliases: Vec<DocTypeAlias>@psalm-type Alias = TypeExpr / @phpstan-type Alias = TypeExpr
import_types: Vec<DocImportType>@psalm-import-type Alias from SourceClass / @phpstan-import-type ...
require_extends: Vec<String>@psalm-require-extends ClassName / @phpstan-require-extends ClassName
require_implements: Vec<String>@psalm-require-implements InterfaceName / @phpstan-require-implements InterfaceName
since: Option<String>@since X.Y — first PHP version this symbol exists in.
removed: Option<String>@removed X.Y — first PHP version this symbol no longer exists in.
invalid_annotations: Vec<String>Malformed type annotations detected during parsing.
mir_checks: Vec<(String, String)>@mir-check EXPR is TYPE — (expr_text, type_string). expr_text is
kept verbatim (e.g. $h->status, self::$prop, $arr['key']) and
parsed as a real PHP expression by the consumer, not just a bare
variable name.
trace_vars: Vec<String>@trace $var1, $var2 or @trace $var1 $var2 — variable names to trace
taint_sinks: Vec<(String, String)>@taint-sink <kind> $param — (param_name_without_dollar, sink_kind_string)
is_taint_source: bool@taint-source — this function/method’s return value is tainted.
seal_properties: bool@seal-properties / @psalm-seal-properties — disallows undeclared property access.
if_this_is: Option<Type>@if-this-is Type / @psalm-if-this-is Type — the method may only be
called when $this satisfies this type. Stored as the raw parsed type;
class names are resolved later by the collector.
self_out: Option<Type>@psalm-self-out Type / @phpstan-self-out Type — the receiver’s type
after this call returns. Stored as the raw parsed type; class names
(and self/static) are resolved later by the collector.
data_providers: Vec<String>@dataProvider methodName (PHPUnit) — name of the method that supplies
this test’s data, invoked by PHPUnit via reflection rather than a call.
Implementations§
Source§impl ParsedDocblock
impl ParsedDocblock
Sourcepub fn get_param_type(&self, name: &str) -> Option<&Type>
pub fn get_param_type(&self, name: &str) -> Option<&Type>
Returns the type for a given parameter name (strips leading $).
Uses the last match so that @psalm-param / @phpstan-param (which
php-rs-parser maps to the same Param variant as @param) overrides a
preceding plain @param annotation.
Sourcepub fn get_out_param_type(&self, name: &str) -> Option<&Type>
pub fn get_out_param_type(&self, name: &str) -> Option<&Type>
Returns the @param-out / @psalm-param-out type for a given parameter
name, if declared. Uses the last match.
Trait Implementations§
Source§impl Clone for ParsedDocblock
impl Clone for ParsedDocblock
Source§fn clone(&self) -> ParsedDocblock
fn clone(&self) -> ParsedDocblock
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParsedDocblock
impl Debug for ParsedDocblock
Source§impl Default for ParsedDocblock
impl Default for ParsedDocblock
Source§fn default() -> ParsedDocblock
fn default() -> ParsedDocblock
Auto Trait Implementations§
impl Freeze for ParsedDocblock
impl RefUnwindSafe for ParsedDocblock
impl Send for ParsedDocblock
impl Sync for ParsedDocblock
impl Unpin for ParsedDocblock
impl UnsafeUnpin for ParsedDocblock
impl UnwindSafe for ParsedDocblock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more