Context
in package
Context.
The context in which the annotation is parsed. It includes useful metadata which the Processors can use to augment the annotations.
Context hierarchy:
- parseContext |- docBlockContext |- classContext |- docBlockContext |- propertyContext |- methodContext
Table of Contents
- $annotations : array<string|int, AbstractAnnotation>
- $character : int
- $class : string
- $comment : string
- $extends : array<string|int, mixed>|string
- $filename : string
- $generated : bool
- $implements : array<string|int, mixed>
- $interface : string
- $line : int
- $logger : LoggerInterface
- $method : string
- $namespace : string
- $nested : AbstractAnnotation
- $nullable : bool
- $property : string
- $static : bool
- $trait : string
- $type : string
- $uses : array<string|int, mixed>
- $_parent : Context
- Prototypical inheritance for properties.
- __construct() : mixed
- __debugInfo() : mixed
- __get() : mixed
- Traverse the context tree to get the property value.
- __toString() : mixed
- detect() : Context
- Create a Context based on the debug_backtrace.
- fullyQualifiedName() : string
- Resolve the fully qualified name.
- getDebugLocation() : string
- Export location for debugging.
- getRootContext() : Context
- is() : bool
- Check if a property is set directly on this context and not its parent context.
- not() : bool
- Check if a property is NOT set directly on this context and but its parent context.
- phpdocContent() : string
- The text contents of the phpdoc comment (excl. tags).
- phpdocDescription() : string
- An optional longer piece of text providing more details on the associated element’s function. This is very useful when working with a complex element.
- phpdocSummary() : string
- A short piece of text, usually one line, providing the basic function of the associated element.
- with() : Context|null
- Return the context containing the specified property.
Properties
$annotations
public
array<string|int, AbstractAnnotation>
$annotations
$character
public
int
$character
$class
public
string
$class
$comment
public
string
$comment
The PHP DocComment
$extends
public
array<string|int, mixed>|string
$extends
Interfaces may extend a list of interfaces
$filename
public
string
$filename
$generated
public
bool
$generated
Indicate the context was generated by a processor or the serializer
$implements
public
array<string|int, mixed>
$implements
$interface
public
string
$interface
$line
public
int
$line
$logger
public
LoggerInterface
$logger
Guaranteed to be set when using the Generator
$method
public
string
$method
$namespace
public
string
$namespace
$nested
public
AbstractAnnotation
$nested
$nullable
public
bool
$nullable
Indicate a nullable value
$property
public
string
$property
$static
public
bool
$static
Indicate a static method
$trait
public
string
$trait
$type
public
string
$type
$uses
public
array<string|int, mixed>
$uses
$_parent
Prototypical inheritance for properties.
private
Context
$_parent
Methods
__construct()
public
__construct([array<string|int, mixed> $properties = [] ][, Context $parent = null ]) : mixed
Parameters
- $properties : array<string|int, mixed> = []
-
new properties for this context
- $parent : Context = null
-
The parent context
Return values
mixed —__debugInfo()
public
__debugInfo() : mixed
Return values
mixed —__get()
Traverse the context tree to get the property value.
public
__get(string $property) : mixed
Parameters
- $property : string
Return values
mixed —__toString()
public
__toString() : mixed
Return values
mixed —detect()
Create a Context based on the debug_backtrace.
public
static detect(int $index) : Context
Parameters
- $index : int
Tags
Return values
Context —fullyQualifiedName()
Resolve the fully qualified name.
public
fullyQualifiedName(string $source) : string
Parameters
- $source : string
-
The source name (class/interface/trait)
Return values
string —getDebugLocation()
Export location for debugging.
public
getDebugLocation() : string
Return values
string —Example: "file1.php on line 12"
getRootContext()
public
getRootContext() : Context
Return values
Context —is()
Check if a property is set directly on this context and not its parent context.
public
is(string $type) : bool
Parameters
- $type : string
-
Example: $c->is('method') or $c->is('class')
Return values
bool —not()
Check if a property is NOT set directly on this context and but its parent context.
public
not(string $type) : bool
Parameters
- $type : string
-
Example: $c->not('method') or $c->not('class')
Return values
bool —phpdocContent()
The text contents of the phpdoc comment (excl. tags).
public
phpdocContent() : string
Return values
string —phpdocDescription()
An optional longer piece of text providing more details on the associated element’s function. This is very useful when working with a complex element.
public
phpdocDescription() : string
Return values
string —phpdocSummary()
A short piece of text, usually one line, providing the basic function of the associated element.
public
phpdocSummary() : string
Return values
string —with()
Return the context containing the specified property.
public
with(string $property) : Context|null
Parameters
- $property : string