Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[PropertyInfo] Allow nested collections#28012

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:3.4fromjderusse:fix-deep-array
Aug 2, 2018

Conversation

@jderusse
Copy link
Member

QA
Branch?3.4
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsNA
LicenseMIT
Doc PRNA

When a multidimentional collection is defined (in a docblock) the extractor does not resolve the className deeply

#inputclass Foo {  /**   * @var Baz[][]   */  public $bar;}
# current resultbuiltinType: arraycollectionValueType:   builtinType: object  class: Baz[]
# FIXbuiltinType: arraycollectionValueType:   builtinType: array  collectionValueType:     builtinType: object    class: Baz

The 2.8 version has also that bug, but the methods have been moved to another class. Should I create an other PR for 2.8?

@ostrolucky
Copy link
Contributor

ostrolucky commentedJul 21, 2018
edited
Loading

There is another change you left out

For:

/** @var mixed[][] */

before:

builtintype:arraycollectionKeyType:nullcollectionValueType:null

after:

builtintype:arraycollectionKeyType:builtintype:intcollectionValueType:builtintype:array

@jderusse
Copy link
MemberAuthor

jderusse commentedJul 21, 2018
edited by lyrixx
Loading

Hi@ostrolucky ,

I agreed, that I didn't handle themixed[] the same way than before, but I think the new return is

builtintype: arraycollectionKeyType:  builtintype: intcollectionValueType: null

(because of line 92) can you please double check?

Which led to a different behavior for the fieldcollectionKeyType because, this is what I would expect. And I though it was a bug too: Whyint[],bool[],object[] will not return the same collectionKeyType thanmixed[]?
Should I consider it has a BC break?

@ostrolucky
Copy link
Contributor

ostrolucky commentedJul 21, 2018
edited
Loading

I double checked. Please write unit test for this.

@nicolas-grekasnicolas-grekas changed the titleAllow multidimensional collection in property info[PropertyInfo] Allow multidimensional collectionJul 23, 2018
@nicolas-grekasnicolas-grekas added this to the3.4 milestoneJul 23, 2018
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

(for 2.8, PR welcome if the bug exists there also I suppose)

'bal',
'parent',
'collection',
'deepCollection',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

A very minor comment: is there any reason for calling thisdeepCollection instead ofnestedCollection? The nested one sounds more natural to me. Thanks!

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

fixed

@ostrolucky
Copy link
Contributor

ostrolucky commentedJul 23, 2018
edited
Loading

mixed[][] behavior not clarified. What's the consensus? Seems there is different behavior currently than expected by author

@ostrolucky
Copy link
Contributor

Also, not sure it's right to always useint for keyType, as there is no way to specify via docblock otherwise

@jderusse
Copy link
MemberAuthor

jderusse commentedJul 24, 2018
edited
Loading

I reverted changes onmixed[] as PhpDocumentor castmixed[] to genericarray =>https://github.com/phpDocumentor/TypeResolver/blob/0.4.0/src/Types/Array_.php#L80-L82.

nowmixed[] will return (as before)

builtintype: arraycollectionKeyType: nullcollectionValueType: null

@jderussejderusse changed the title[PropertyInfo] Allow multidimensional collection[PropertyInfo] Allow nested collectionsJul 24, 2018
fabpot added a commit that referenced this pull requestAug 2, 2018
This PR was merged into the 2.8 branch.Discussion----------[PropertyInfo] Allow nested collections| Q             | A| ------------- | ---| Branch?       | 2.8| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets || License       | MIT| Doc PR        |Duplicate of#28012 for the 2.8 branche (as both code and test have been refactored between 2.8 and 3.xCommits-------6331687 Allow multidimensional collection in property info
@fabpot
Copy link
Member

Thank you@jderusse.

@fabpotfabpot merged commitce49036 intosymfony:3.4Aug 2, 2018
fabpot added a commit that referenced this pull requestAug 2, 2018
This PR was merged into the 3.4 branch.Discussion----------[PropertyInfo] Allow nested collections| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | NA| License       | MIT| Doc PR        | NAWhen a multidimentional collection is defined (in a docblock) the extractor does not resolve the className deeply```#inputclass Foo {  /**   *@var Baz[][]   */  public $bar;}``````# current resultbuiltinType: arraycollectionValueType:  builtinType: object  class: Baz[]``````# FIXbuiltinType: arraycollectionValueType:  builtinType: array  collectionValueType:    builtinType: object    class: Baz```The 2.8 version has also that bug, but the methods have been moved to another class. Should I create an other PR for 2.8?Commits-------ce49036 Allow multidimensional collection in property info
@nicolas-grekas
Copy link
Member

@jderusse or anyone else: PropertyInfo 3.4 is red currently, could you have a look please?

@jderusse
Copy link
MemberAuthor

cheking it

@jderusse
Copy link
MemberAuthor

@nicolas-grekas shouldn't it be fixed byfe482cc ?

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedAug 3, 2018
edited
Loading

Looks like so. It wasn't passing locally, but I suppose that's because I didn't run composer update before... Sorry for the false alarm.

@nicolas-grekas
Copy link
Member

When merging into master, I added this commit to make tests pass:a5516fc

Please check and submit a PR if the patch should be improved.

This was referencedAug 28, 2018
@jderussejderusse deleted the fix-deep-array branchAugust 2, 2019 12:15
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@dunglasdunglasAwaiting requested review from dunglasdunglas is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

6 participants

@jderusse@ostrolucky@fabpot@nicolas-grekas@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp