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

Add handling for compound types. #45

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Crell
Copy link
Collaborator

@Crell Crell commented Sep 12, 2022

There's likely to be discussion on this, but this PR gets us started. Discuss.

@Crell Crell mentioned this pull request Sep 12, 2022
25 tasks
function veryComplex(
array
|(ArrayAccess&Traversable)
|(Traversable&Countable) $input): ArrayAccess&Traversable
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
|(Traversable&Countable) $input): ArrayAccess&Traversable
|(Traversable&Countable) $input
): ArrayAccess&Traversable

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hm. Not sure here. Does this context also force multilining the return part? If so, that should be said explicitly somewhere.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah doing this would split the argument list over multiple lines and would make "argument list is split across multiple lines" rules apply here. I get that this is different than actually splitting each argument onto their own lines but I don't think that distinction matters at all when it comes to readability and consistency.

spec.md Outdated Show resolved Hide resolved
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
that all compound types be structured as an ORed (unioned) series of ANDs (intersections), and that each set of
intersections be encased with parentheses.

The union symbol `|` and intersection symbol `&` MUST NOT have a leading or trailing space. The parentheses MUST NOT
Copy link
Contributor

@TimWolla TimWolla Sep 29, 2022

Choose a reason for hiding this comment

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

While I personally agree that there should be no spaces around the "symbols", this appears to be inconsistent with catch() which has spaces around in the example:

} catch (OtherThrowableType | AnotherThrowableType $e) {

Copy link
Contributor

@samdark samdark Sep 30, 2022

Choose a reason for hiding this comment

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

That should be unified one way or another 👍

Copy link
Contributor

@KorvinSzanto KorvinSzanto left a comment

Choose a reason for hiding this comment

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

Needs:

  • Consistency with catch() or an argument for not being consistent
  • Consistency with mutliline declaration requirements

@KorvinSzanto
Copy link
Contributor

I think the catch consistency question is a big one so I've opened a vote in discord for the WG to decide the way to move forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants