Skip to content

Docblock Annotations

mir understands the following docblock annotations.

AnnotationEffect
@param Type $nameParameter type override
@return TypeReturn type override
@var TypeVariable type annotation
@throws ClassNameDeclares thrown exception
AnnotationEffect
@template TDeclares a type parameter
@template T of UBounded type parameter (T must extend U)
AnnotationEffect
@psalm-suppress IssueNameSuppress a specific issue at this site
@psalm-pureMarks function as side-effect-free
@psalm-immutableMarks class as immutable
AnnotationEffect
@deprecatedMarks class/method as deprecated (emits DeprecatedMethod/DeprecatedClass)
@internalMarks as internal (emits InternalMethod if called from outside the package)

mir supports standard Psalm/PHPStan type syntax:

int|string union
?string nullable (shorthand for string|null)
array<int, string> typed array
list<string> list (sequential integer keys from 0)
class-string<T> string containing a class name
callable callable type
never bottom type (function never returns)
void function returns with no value
mixed any type