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

[TASK] Update cuyz/valinor to v1.9.0 #467

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Feb 2, 2024

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
cuyz/valinor 1.8.2 -> 1.9.0 age adoption passing confidence

Release Notes

CuyZ/Valinor (cuyz/valinor)

v1.9.0

Compare Source

Notable changes

JSON normalizer

The normalizer is able to normalize a data structure to JSON without using the native json_encode() function.

Using the normalizer instead of the native json_encode() function offers some benefits:

  • Values will be recursively normalized using the default transformations
  • All registered transformers will be applied to the data before it is formatted
  • The JSON can be streamed to a PHP resource in a memory-efficient way

Basic usage:

namespace My\App;

$normalizer = (new \CuyZ\Valinor\MapperBuilder())
    ->normalizer(\CuyZ\Valinor\Normalizer\Format::json());

$userAsJson = $normalizer->normalize(
    new \My\App\User(
        name: 'John Doe',
        age: 42,
        country: new \My\App\Country(
            name: 'France',
            code: 'FR',
        ),
    )
);

// `$userAsJson` is a valid JSON string representing the data:
// {"name":"John Doe","age":42,"country":{"name":"France","code":"FR"}}

By default, the JSON normalizer will return a JSON string representing the data it was given. Instead of getting a string, it is possible to stream the JSON data to a PHP resource:

$file = fopen('path/to/some_file.json', 'w');

$normalizer = (new \CuyZ\Valinor\MapperBuilder())
    ->normalizer(\CuyZ\Valinor\Normalizer\Format::json())
    ->streamTo($file);

$normalizer->normalize(/* … */);

// The file now contains the JSON data

Another benefit of streaming the data to a PHP resource is that it may be more memory-efficient when using generators — for instance when querying a database:

// In this example, we assume that the result of the query below is a
// generator, every entry will be yielded one by one, instead of
// everything being loaded in memory at once.
$users = $database->execute('SELECT * FROM users');

$file = fopen('path/to/some_file.json', 'w');

$normalizer = (new \CuyZ\Valinor\MapperBuilder())
    ->normalizer(\CuyZ\Valinor\Normalizer\Format::json())
    ->streamTo($file);

// Even if there are thousands of users, memory usage will be kept low
// when writing JSON into the file.
$normalizer->normalize($users);
Features
  • Introduce JSON normalizer (959740)

Bug Fixes

  • Add default transformer for DateTimeZone (acf097)
  • Detect circular references linearly through objects (36aead)
Other
  • Refactor attribute definition to include class definition (4b8cf6)

Configuration

📅 Schedule: Branch creation - "every weekday" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot added the dependencies Updates project dependencies label Feb 2, 2024
Copy link

codeclimate bot commented Feb 2, 2024

Code Climate has analyzed commit cb4db58 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 96.4% (0.0% change).

View more on Code Climate.

@renovate renovate bot force-pushed the renovate/cuyz-valinor-1.x-lockfile branch from 384d0d4 to e5906e8 Compare February 5, 2024 10:00
| datasource | package      | from  | to    |
| ---------- | ------------ | ----- | ----- |
| packagist  | cuyz/valinor | 1.8.2 | 1.9.0 |
@renovate renovate bot force-pushed the renovate/cuyz-valinor-1.x-lockfile branch from e5906e8 to cb4db58 Compare February 6, 2024 12:50
@eliashaeussler eliashaeussler merged commit a85b9d8 into main Feb 6, 2024
43 checks passed
@eliashaeussler eliashaeussler deleted the renovate/cuyz-valinor-1.x-lockfile branch February 6, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Updates project dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant