Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I specify array of objects in PhpDoc [duplicate]

Tags:

php

phpdoc

I use PhpDocumentor2 for generating documentation. I searched for this subject but I can't find specific rule for it. For Example I have class which name is AddressField and I want to specify my $addressFields as array of AddressField objects.

/**
 * @var AddressField[]
 */
private $addressFields;
like image 624
Farid Movsumov Avatar asked Nov 19 '12 14:11

Farid Movsumov


1 Answers

phpdoc themselves describe the use of arrays here:

1.4.4. Arrays

  • undefined: @return array
  • single type: @return int[]
  • multi type: @return (int|string)[]

The same should apply to variable definitions:

/* @var Type[] $arr */
like image 177
schmijos Avatar answered Oct 22 '22 05:10

schmijos