Skip to main content

ParsedDocblock

Struct ParsedDocblock 

Source
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: String

Free 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

Source

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.

Source

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

Source§

fn clone(&self) -> ParsedDocblock

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParsedDocblock

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ParsedDocblock

Source§

fn default() -> ParsedDocblock

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Lookup<T> for T

Source§

fn into_owned(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more