Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions proposed/phpdoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ An example of this is:

```php
/**
* @method int MyMagicMethod(string $argument1) {
* @method MyMagicMethod(string $argument1): int {
* This is the summary for MyMagicMethod.
*
* @param string $argument1 Description for argument 1.
Expand Down Expand Up @@ -578,7 +578,7 @@ Some tags may even feature an "Inline PHPDoc" as shown in the following example.

```php
/**
* @method int MyMagicMethod(string $argument1) {
* @method MyMagicMethod(string $argument1): int {
* This is the summary for MyMagicMethod.
*
* @param string $argument1 Description for argument 1.
Expand Down Expand Up @@ -1220,18 +1220,19 @@ The @method allows a class to know which 'magic' methods are callable.

#### Syntax

@method [return type] [name]([type] [parameter], [...]) [description]
@method [static] [name]([type] [parameter], [...])[: return type] [description]

#### Description

The @method tag is used in situation where a class contains the `__call()` magic
method and defines some definite uses.
The @method tag is used in situation where a class contains the `__call()` or
`__callStatic()` magic methods and defines some definite uses.

An example of this is a child class whose parent has a `__call()` to have dynamic
getters or setters for predefined properties. The child knows which getters and
setters need to be present but relies on the parent class to use the `__call()`
method to provide it. In this situation, the child class would have a @method
tag for each magic setter or getter method.
An example of this is a child class whose parent has a `__call()` or
`__callStatic` to have dynamic getters or setters for predefined properties.
The child knows which getters and setters need to be present but relies on the
parent class to use the `__call()` or `__callStatic()` method to provide it.
In this situation, the child class would have a @method tag for each magic
setter or getter method.

The @method tag allows the author to communicate the type of the arguments and
return value by including those types in the signature.
Expand All @@ -1254,9 +1255,11 @@ class Parent
}

/**
* @method string getString()
* @method void setInteger(int $integer)
* @method getString(): string
* @method setInteger(int $integer): void
* @method setString(int $integer)
* @method static setStaticString(int $integer)
* @method static setStaticStringFluid(int $integer): static
*/
class Child extends Parent
{
Expand Down