8000 [PropertyInfo] Implement "Collection" types in PhpDocExtractor · Issue #26299 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[PropertyInfo] Implement "Collection" types in PhpDocExtractor #26299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
popy-dev opened this issue Feb 24, 2018 · 0 comments
Closed

[PropertyInfo] Implement "Collection" types in PhpDocExtractor #26299

popy-dev opened this issue Feb 24, 2018 · 0 comments

Comments

@popy-dev
Copy link
Contributor
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no
Symfony version master

The phpdocumentor/reflection-docblock supports "Collection" types declarations, yet PropetyInfo is unable to convert them properly.

What I mean with "Collection" is this :

/**
 * @var Iterator<DateTime>
 */
protected $iterator;

It could be helpful if PropertyInfo was able to return, at least, the Collection classname (Iterator in this case).

@fabpot fabpot closed this as completed Jun 26, 2018
fabpot added a commit that referenced this issue Jun 26, 2018
…xtractor (popy-dev)

This PR was squashed before being merged into the 4.2-dev branch (closes #26300).

Discussion
----------

[PropertyInfo] Implement "Collection" types in PhpDocExtractor

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #26299
| License       | MIT
| Doc PR        | todo

Here's a proposition of implementation of my feature request #26299 :
I added few tests covering the requested feature, and I had to change a few things in the ```Symfony\Component\PropertyInfo\Util\PhpDocTypeHelper``` class (createType no longer gets a string, but a ```phpDocumentor\Reflection\Type``` instance) to be able to detect properly Collections and their subtypes.

Of course a simpler implementation is possible, without changing the PhpDocTypeHelper internal behaviour, by matching the input string against ```/^([^>]+)</``` and extracting the classname alone.

Commits
-------

12bafe4 [PropertyInfo] Implement \"Collection\" types in PhpDocExtractor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0