Documentation

Annotation

Interface for annotation processing

Table of Contents

TYPE_CLASS  = 'class'
TYPE_METHOD  = 'method'
TYPE_PROPERTY  = 'property'
name()  : string
The name of the annotation
process()  : void
Processes the annotation
regex()  : string
The regular expression for processing the annotation if the name was found
types()  : array<string|int, mixed>
The types of the annotation

Constants

TYPE_PROPERTY

public mixed TYPE_PROPERTY = 'property'

Methods

name()

The name of the annotation

public name() : string

For example, if the name is 'route', then the AnnotationProcessor will search for '* @route ' in the comments first.

Return values
string

process()

Processes the annotation

public process(string $type, string $className, mixed $subject, string $comment, array<string|int, mixed> $matches) : void
Parameters
$type : string

The type of the annotation (can be: class, property, method)

$className : string

The name of the class

$subject : mixed

The reflected class/property/method (depends on the $type)

$comment : string

The full comment without new lines

$matches : array<string|int, mixed>

The matches from the regex

Return values
void

regex()

The regular expression for processing the annotation if the name was found

public regex() : string

It will be used like this:

Asterisk Space @name Space regex Space Asterisk in non greedy mode

/\*\s\@{$this->name()}\s{$this->regex()}\s\*/U
Return values
string

types()

The types of the annotation

public types() : array<string|int, mixed>

Can be: class, property, method

Return values
array<string|int, mixed>

Search results