Skip to content

Does PER 3.0 has an issue with "very complex" example in section 2.5? #131

Open

Description

@levdovlatov

Hey, everyone!

Just noticed the way how "very complex" example is being put in 2.5:

Image

I would think it is a little bit illogical, because it violates of how we're formatting multiline arguments for functions, see 4.5:

Image

Another example is the same 2.5 section:

function somethingWithReflection(
    \ReflectionObject
    |\ReflectionClass
    |\ReflectionMethod
    |\ReflectionParameter
    |\ReflectionProperty $reflect
): object|null {
        // ...
}

That's why I suspect it is just a typo, and correct example for "veryComplex" would be:

function veryComplex(
    array
    |(ArrayAccess&Traversable)
    |(Traversable&Countable) $input
): ArrayAccess&Traversable {
    // ...
}

WDYT about it?

Feel free to ask me to create PR if my assumptions are correct 🙌

Best regards

Activity

  1. levdovlatov commented on Nov 25, 2025

    @levdovlatov
    Author

    By the way, as separate question, I wonder if comma should or should not be put at the end of argument line in such cases 🤔
    The rules are a little bit ambiguous here, but I'd think that we need to put a trailing comma after such arguments, so examples in 2.5 might need such kind of tweaking as well.
    WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions