---
title: "Using phpDoc"
manual: "TYPO3 Explained"
version: "13.4"
permalink: "https://docs.typo3.org/permalink/t3coreapi:cgl-using-phpdoc@13.4"
source: "CodingGuidelines/CglPhp/UsingPhpdoc.rst"
rendered: "2026-09-21T07:21:01+00:00"
---

# Using phpDoc {#cgl-using-phpdoc}

"phpDocumentor" ([phpDoc](https://www.phpdoc.org/)) is used for documenting
source code. TYPO3 code typically uses the following [phpDoc](https://www.phpdoc.org/) keywords:

-   `@global`
-   `@param`
-   `@return`
-   `@see`
-   `@var`
-   `@deprecated`

For more information on [phpDoc](https://www.phpdoc.org/) see the [phpDoc](https://www.phpdoc.org/) web site at
[https://www.phpdoc.org/](https://www.phpdoc.org/).

TYPO3 does **not** require that *each class, function* and *method* be
documented with [phpDoc](https://www.phpdoc.org/).

But documenting types is required. If you cannot use *type hints* then a
docblock is mandatory to describe the types..

Additionally you should add a [phpDoc](https://www.phpdoc.org/) block if additional information seems
appropriate:

-   An example would be the detailed description of the content of arrays using
    the Object\[\] notation.
-   If the return type is mixed and cannot be annotated strictly, add a
    @return tag.
-   If parameters or return types have specific syntactical requirements:
    document that!

The different parts of a [phpDoc](https://www.phpdoc.org/) statement after the keyword are separated by
**one single space.**

## Class information block {#cgl-using-phpdoc-class-information-block}

((to be written))

((was: For information on phpDoc use for class declarations see "Class
information block".))

## Function information block {#cgl-using-phpdoc-function-information-block}

Functions should have *parameters* and *the return type* documented. Example:

**EXT:some_extension/Classes/SomeClass.php**

```php
/**
 * Initializes the plugin.
 *
 * Checks the configuration and substitutes defaults for missing values.
 *
 * @param array $conf Plugin configuration from TypoScript
 * @return bool true if initialization was successful, false otherwise
 * @see MyClass:anotherFunc()
 */
protected function initialize(array $conf): bool
{
    // Do something
}
```

### Short and long description {#cgl-using-phpdoc-function-information-block-short-long}

A method or class may have both a short and a long description. The
short description is the first piece of text inside the phpDoc block.
It ends with the next blank line. Any additional text after that line
and before the first tag is the long description.

In the comment blocks use the *short* forms of the type names (e.g.
`int`, `bool`, `string`, `array` or
`mixed`).

Use `@return void` when a function does *not* return a value.
