Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Added additional php doc blocks with examples #6223

Merged
merged 8 commits into from
Jan 17, 2020
41 changes: 41 additions & 0 deletions src/guides/v2.3/coding-standards/docblock-standard-general.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,12 @@ interface MutableInterface
*/
class LimitedMutableClass implements MutableInterface
{
/**
* Returns integer value
*/
public function getVal(): int
{
...
}

/**
Expand All @@ -586,6 +590,7 @@ class LimitedMutableClass implements MutableInterface
*/
public function setVal($value): void
{
...
}
}
```
Expand Down Expand Up @@ -685,6 +690,42 @@ Specifically, this is possible when a PHP-file composed from multiple file inclu
*/
```

### @method tag {#method}

The `@method` allows a class to know which ‘magic’ methods are callable.

Syntax:

```bash
@method [[static] return type] [name]([[type] [parameter]<, ...>]) [<description>]
```

[See](https://docs.phpdoc.org/references/phpdoc/tags/method.html) more information about `@method` tag.

```php
/**
* Image operations
*
* @method string getFile()
* @method string getLabel()
* @method string getPosition()
*/
class Image extends \Magento\Framework\Model\AbstractModel
{
//.....
}
```

### @link tag {#link}

The `@link` tag indicates a custom relation between associated Structural Elements and a website, which is identified by an absolute URI.

Syntax:

```bash
@link [URI] [<description>]
```

### Other tags

Any other valid DocBlock tags may be specified, if author deems necessary, but only if they bring any valuable not obvious information.
Expand Down