\phpDocumentor\DescriptorFileDescriptor

Represents a file in the project.

This class contains all structural elements of the file it represents. In most modern projects a file will contain a single element like a Class, Interface or Trait, sometimes multiple functions. Depending on the config settings of the parsed project it might include all source code from the file in the project.

Summary

Methods
Properties
Constants
__construct()
getFullyQualifiedStructuralElementName()
getName()
getNamespace()
getSummary()
getDescription()
getPath()
getFile()
getLine()
getTags()
getPackage()
getAuthor()
getVersion()
getCopyright()
isDeprecated()
getErrors()
__call()
__toString()
getInheritedElement()
getHash()
getSource()
getNamespaceAliases()
getIncludes()
getConstants()
getFunctions()
getClasses()
getInterfaces()
getTraits()
getMarkers()
getAllErrors()
No public properties found
No constants found
setHash()
$fqsen
$name
$namespace
$package
$summary
$description
$fileDescriptor
$line
$tags
$errors
$inheritedElement
$hash
$path
$source
$namespaceAliases
$includes
$constants
$functions
$classes
$interfaces
$traits
$markers
N/A
No private methods found
No private properties found
N/A

Properties

$fqsen

$fqsen : \phpDocumentor\Reflection\Fqsen

Type

\phpDocumentor\Reflection\Fqsen — Fully Qualified Structural Element Name; the FQCN including method, property or constant name

$name

$name : string

Type

string — The local name for this element

$namespace

$namespace : \phpDocumentor\Descriptor\NamespaceDescriptor|string

Type

NamespaceDescriptor|string — The namespace for this element

$package

$package : \phpDocumentor\Descriptor\PackageDescriptor|string

Type

PackageDescriptor|string — The package with which this element is associated

$summary

$summary : string

Type

string — A summary describing the function of this element in short.

$description

$description : \phpDocumentor\Descriptor\DocBlock\DescriptionDescriptor|null

Type

DescriptionDescriptor|null — A more extensive description of this element.

$fileDescriptor

$fileDescriptor : \phpDocumentor\Descriptor\FileDescriptor|null

Type

FileDescriptor|null — The file to which this element belongs; if applicable

$line

$line : int

Type

int — The line number on which this element occurs.

$tags

$tags : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\TagDescriptor>>

Type

TagDescriptor>> — The tags associated with this element.

$errors

$errors : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\Validation\Error>

Type

Error> — A list of errors found while building this element.

$inheritedElement

$inheritedElement : \phpDocumentor\Descriptor\DescriptorAbstract|null

Type

DescriptorAbstract|null — the element from which to inherit information in this element

$hash

$hash : string

Type

string

$path

$path : string

Type

string

$namespaceAliases

$namespaceAliases : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\NamespaceDescriptor>|\phpDocumentor\Descriptor\Collection<\phpDocumentor\Reflection\Fqsen>

Type

Fqsen>

$includes

$includes : \phpDocumentor\Descriptor\Collection<string>

Type

Collection

$constants

$constants : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\ConstantDescriptor>

Type

ConstantDescriptor>

$functions

$functions : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\FunctionDescriptor>

Type

FunctionDescriptor>

$classes

$classes : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\ClassDescriptor>

Type

ClassDescriptor>

$interfaces

$interfaces : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\InterfaceDescriptor>

Type

InterfaceDescriptor>

$traits

$traits : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\TraitDescriptor>

Type

TraitDescriptor>

$markers

$markers : \phpDocumentor\Descriptor\Collection<array<int|string,mixed>>

Type

Collection>

Methods

__construct()

__construct(string  $hash) : mixed

Initializes a new file descriptor with the given hash of its contents.

Parameters

string $hash

An MD5 hash of the contents if this file.

Returns

mixed —

getFullyQualifiedStructuralElementName()

getFullyQualifiedStructuralElementName() : ?\phpDocumentor\Reflection\Fqsen

Returns the Fully Qualified Structural Element Name (FQSEN) for this element.

Returns

?\phpDocumentor\Reflection\Fqsen —

getName()

getName() : string

Returns the local name for this element.

Returns

string —

getNamespace()

getNamespace() : \phpDocumentor\Descriptor\NamespaceDescriptor|string

Returns the namespace for this element (defaults to global "\")

Returns

\phpDocumentor\Descriptor\NamespaceDescriptor|string —

getSummary()

getSummary() : string

Returns the summary which describes this element.

This method will automatically attempt to inherit the parent's summary if this one has none.

Returns

string —

getDescription()

getDescription() : ?\phpDocumentor\Descriptor\DocBlock\DescriptionDescriptor

Returns the description for this element.

This method will automatically attempt to inherit the parent's description if this one has none.

Returns

?\phpDocumentor\Descriptor\DocBlock\DescriptionDescriptor —

getPath()

getPath() : string

Returns the relative file path.

The path is a relative to the source file based on the dsn of the config.

Returns

string —

getFile()

getFile() : ?\phpDocumentor\Descriptor\FileDescriptor

Returns the file in which this element resides or null in case the element is not bound to a file.

.

Returns

?\phpDocumentor\Descriptor\FileDescriptor —

getLine()

getLine() : int

Returns the line number where the definition for this element can be found.

Returns

int —

getTags()

getTags() : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\TagDescriptor>>

Returns the tags associated with this element.

Returns

\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\TagDescriptor>> —

getPackage()

getPackage() : ?\phpDocumentor\Descriptor\PackageDescriptor

Returns the package name for this element.

Returns

?\phpDocumentor\Descriptor\PackageDescriptor —

getAuthor()

getAuthor() : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\Tag\AuthorDescriptor>

Returns

\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\Tag\AuthorDescriptor> —

getVersion()

getVersion() : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\VersionDescriptor>

Returns the versions for this element.

Returns

\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\VersionDescriptor> —

getCopyright()

getCopyright() : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\TagDescriptor>

Returns the copyrights for this element.

Returns

\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\TagDescriptor> —

isDeprecated()

isDeprecated() : bool

Checks whether this element is deprecated.

Returns

bool —

getErrors()

getErrors() : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\Validation\Error>

Returns all errors that occur in this element.

Returns

\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\Validation\Error> —

__call()

__call(string  $name, array  $arguments) : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\TagDescriptor>|null

Dynamically constructs a set of getters to retrieve tag (collections) with.

Important: __call() is not a fast method of access; it is preferred to directly use the getTags() collection. This interface is provided to allow for uniform and easy access to certain tags.

Parameters

string $name
array $arguments

Returns

\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\TagDescriptor>|null —

__toString()

__toString() : string

Represents this object by its unique identifier, the Fully Qualified Structural Element Name.

Returns

string —

getInheritedElement()

getInheritedElement() : \phpDocumentor\Descriptor\DescriptorAbstract|string|\phpDocumentor\Reflection\Fqsen|null

Returns

\phpDocumentor\Descriptor\DescriptorAbstract|string|\phpDocumentor\Reflection\Fqsen|null —

getHash()

getHash() : string

Returns the hash of the contents for this file.

Returns

string —

getSource()

getSource() : ?string

Retrieves the contents of this file.

When source is included in parsing process this property will contain the raw file contents.

Returns

?string —

getNamespaceAliases()

getNamespaceAliases() : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\NamespaceDescriptor>|\phpDocumentor\Descriptor\Collection<\phpDocumentor\Reflection\Fqsen>

Returns the namespace aliases that have been defined in this file.

A namespace alias can either be a full descriptor of the namespace or just a {@see} when the namespace was not part of the processed code. When it is a {@see} it will contain all structural elements in the namespace not just the once in this particlar file.

Returns

\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\NamespaceDescriptor>|\phpDocumentor\Descriptor\Collection<\phpDocumentor\Reflection\Fqsen> —

getIncludes()

getIncludes() : \phpDocumentor\Descriptor\Collection<string>

Returns a list of all includes that have been declared in this file.

Returns

\phpDocumentor\Descriptor\Collection

getConstants()

getConstants() : \phpDocumentor\Descriptor\Collection

Returns a list of constant descriptors contained in this file.

{@inheritDoc}

Returns

\phpDocumentor\Descriptor\Collection —

getFunctions()

getFunctions() : \phpDocumentor\Descriptor\Collection

Returns a list of function descriptors contained in this file.

{@inheritDoc}

Returns

\phpDocumentor\Descriptor\Collection —

getClasses()

getClasses() : \phpDocumentor\Descriptor\Collection

Returns a list of class descriptors contained in this file.

{@inheritDoc}

Returns

\phpDocumentor\Descriptor\Collection —

getInterfaces()

getInterfaces() : \phpDocumentor\Descriptor\Collection

Returns a list of interface descriptors contained in this file.

{@inheritDoc}

Returns

\phpDocumentor\Descriptor\Collection —

getTraits()

getTraits() : \phpDocumentor\Descriptor\Collection

Returns a list of trait descriptors contained in this file.

{@inheritDoc}

Returns

\phpDocumentor\Descriptor\Collection —

getMarkers()

getMarkers() : \phpDocumentor\Descriptor\Collection<array<int|string,mixed>>

Returns a series of markers contained in this file.

A marker is a special inline comment that starts with a keyword and is followed by a single line description.

Example:

// TODO: This is an item that needs to be done.

Returns

\phpDocumentor\Descriptor\Collection> —

getAllErrors()

getAllErrors() : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\Validation\Error>

Returns a list of all errors in this file and all its child elements.

All errors from structual elements in the file are collected to the deepes level.

Returns

\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\Validation\Error> —

setHash()

setHash(string  $hash) : void

Sets the hash of the contents for this file.

Parameters

string $hash