{"action":"created","issue":{"url":"https://api.github.com/repos/phpDocumentor/fig-standards/issues/47","labels_url":"https://api.github.com/repos/phpDocumentor/fig-standards/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/phpDocumentor/fig-standards/issues/47/comments","events_url":"https://api.github.com/repos/phpDocumentor/fig-standards/issues/47/events","html_url":"https://github.com/phpDocumentor/fig-standards/issues/47","id":30864224,"number":47,"title":"Declaring Collections","user":{"login":"mvriel","id":193704,"avatar_url":"https://avatars.githubusercontent.com/u/193704?v=3","gravatar_id":"","url":"https://api.github.com/users/mvriel","html_url":"https://github.com/mvriel","followers_url":"https://api.github.com/users/mvriel/followers","following_url":"https://api.github.com/users/mvriel/following{/other_user}","gists_url":"https://api.github.com/users/mvriel/gists{/gist_id}","starred_url":"https://api.github.com/users/mvriel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvriel/subscriptions","organizations_url":"https://api.github.com/users/mvriel/orgs","repos_url":"https://api.github.com/users/mvriel/repos","events_url":"https://api.github.com/users/mvriel/events{/privacy}","received_events_url":"https://api.github.com/users/mvriel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":79,"created_at":"2014-04-04T14:20:06Z","updated_at":"2015-03-04T18:22:46Z","closed_at":null,"body":"> This is a followup on #6. I have chosen to open a new issue to prevent confusion\r\n\r\nA regularly requested feature for the PHPDoc standard is the ability to describe the type of elements contained in an object representing a Collection (thus implementing the ArrayAccess or Traversable interface).\r\n\r\nAt current this is only possible by using a workaround and defining both an array specifier and object declaration in one `@var` tag:\r\n\r\n```\r\n@var \\DateTime[]|DateTimeCollection My collection of DateTime objects.\r\n```\r\n\r\nWith PSR-5 we want to introduce a construct that is inspired on usages in other languages and within some PHP projects:\r\n\r\n```\r\n@var DateTimeCollection<\\DateTime> My collection of DateTime objects.\r\n```\r\n\r\nor, if you want to specify the keytype:\r\n\r\n```\r\n@var DateTimeCollection<integer,\\DateTime> My collection of DateTime objects.\r\n```\r\n\r\nA type defined inside the angular braces can be of any type, including another Collection type:\r\n\r\n```\r\n@var DateTimeCollection<DateTimeCollection<\\DateTime>> A collection of DateTime objects inside another Collection.\r\n```\r\n\r\nWith this issue I would like to invite anyone to provide feedback, several other notations have been considered but these were unable to provide a concise notation where it is possible to use any type and provide a keyname (more information on request)."},"comment":{"url":"https://api.github.com/repos/phpDocumentor/fig-standards/issues/comments/77214731","html_url":"https://github.com/phpDocumentor/fig-standards/issues/47#issuecomment-77214731","issue_url":"https://api.github.com/repos/phpDocumentor/fig-standards/issues/47","id":77214731,"user":{"login":"mvriel","id":193704,"avatar_url":"https://avatars.githubusercontent.com/u/193704?v=3","gravatar_id":"","url":"https://api.github.com/users/mvriel","html_url":"https://github.com/mvriel","followers_url":"https://api.github.com/users/mvriel/followers","following_url":"https://api.github.com/users/mvriel/following{/other_user}","gists_url":"https://api.github.com/users/mvriel/gists{/gist_id}","starred_url":"https://api.github.com/users/mvriel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvriel/subscriptions","organizations_url":"https://api.github.com/users/mvriel/orgs","repos_url":"https://api.github.com/users/mvriel/repos","events_url":"https://api.github.com/users/mvriel/events{/privacy}","received_events_url":"https://api.github.com/users/mvriel/received_events","type":"User","site_admin":false},"created_at":"2015-03-04T18:22:46Z","updated_at":"2015-03-04T18:22:46Z","body":"@mindplay-dk \r\n\r\nCan you post a complete example of what you mean? I want to make sure that I understand you correctly.\r\n\r\nAlso regarding Generics: You _can_ solve Collection classes using Generics but Collection classes are not by definition subject to Generics. Given all the insights in the past messages I think it best to avoid Generics completely.\r\n\r\nGenerics is first and foremost a language construct and if there is no strong use-case for it than I don't think I want to discuss that as part of PSR-5. TypeScript has got Generics because it actually does something with it, PHPDoc will never be able to. Also: Generics in TypeScript is a language construct (even though it translates to JS), I do not think it is wise to risk conflicting with PHP at a future point without substantial gain (which I don't see).\r\n\r\n@boenrobot \r\n\r\nIt would help if people would use concrete collection classes and no new syntax needs to be invented for those who do. The discussed feature is specific to generic Collection classes or to assist the author of inline documention in his own class.\r\n\r\nYour solution would _require_ people to write code to solve an issue that they want to solve with documentation; both are valid options so lets ignore the first (as that is already possible) and focus on being able to indicate that a property (etc) contains a Collection class with items of a specific type.\r\n\r\nRegarding your proposed syntax; I am not convinced it is the best suited. It looks to similar to accessing static properties or even using methods and for me does not hint that we are talking arrays or array like constructs. "}}