Skip to content

Request: make DataBuilder immutable #135

Open

Description

@temp

Part of #103. Line numbers refer to branch chore/php-8.4-dependabot (#98). Verified = reproduced, suspected = from reading the code.

  • with() / without() read like immutable withers but change the object in place, so reusing a base builder leaks changes into later variants (DataBuilder.php:29-75). Verified.
  • without('x', 'y') on a missing path creates "x": null, and with(1, 'a', 'b') on a scalar a throws a raw TypeError instead of InvalidRequest (DataBuilder.php:37-40). Verified.
  • with($value) without a path is silently ignored.

Breaking: code that relies on in-place mutation ($b->with(...); $b()) has to use the returned instance.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions