Skip to content

Inconsistency: some expressions use splat operator instead of array #599

Description

@fain182

Problem

Some Expression classes in src/Expression/ForClasses/ accept multiple values via splat operator (string ...$args), while others use array.

This inconsistency was first noted by @hgraca in #403.

Classes using splat operator (6)

  • Extend
  • NotExtend
  • ResideInOneOfTheseNamespaces
  • ResideInOneOfTheseNamespacesExactly
  • NotResideInOneOfTheseNamespacesExactly
  • NotResideInTheseNamespaces

Classes already using array (3)

  • DependsOnlyOnTheseNamespaces
  • NotDependsOnTheseNamespaces
  • MatchOneOfTheseNames

Why this is a problem

The codebase is inconsistent: similar expressions use different conventions for accepting multiple values.

Beyond inconsistency, the splat operator also limits future evolution — since variadic parameters must always be last, it is impossible to add a second constructor parameter without a breaking change.

Proposed solution

Standardize all expressions to use array instead of the splat operator.

Activity

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions