Skip to content
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

fix: phpdoc syntax for repeatedfield parameters #9784

Merged

Conversation

bshaffer
Copy link
Contributor

@bshaffer bshaffer commented Apr 13, 2022

The current way we document RepeatedField parameters is ambiguous in PHPDoc. For Collection|Foo[], two possible paths are taken:

  1. If Collection implements Traversable (which RepeatedField does), Collection|Foo[] is interpreted as a Collection object that iterates over Foo. The array part isn’t applied. This is what is currently happening for Protobuf.
  2. If Collection|Foo[] means “Collection or array” (which is what we mean in our case) we need to disambiguate the type by using Collection|array<Foo> instead.

This PR replaces all instance of ProtoClass[]|RepeatedField with the less-ambiguous array<ProtoClass>|RepeatedField

Copy link
Contributor

@perezd perezd left a comment

Choose a reason for hiding this comment

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

LGTM!

@perezd perezd merged commit 9ba808b into protocolbuffers:main Apr 18, 2022
@bshaffer bshaffer deleted the fix-phpdoc-for-repeatedfield-params branch April 19, 2022 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants