Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into version-normalisation
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden committed Jan 2, 2023
2 parents 3dc81d0 + 164e52c commit 1bc7e57
Show file tree
Hide file tree
Showing 302 changed files with 2,515 additions and 1,080 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.github/ export-ignore
/.phive/ export-ignore
/bin/ export-ignore
/test/ export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
Expand Down
1 change: 1 addition & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ For details, take a look at the following workflow configuration files:
- [`workflows/release.yaml`](workflows/release.yaml)
- [`workflows/renew.yaml`](workflows/renew.yaml)
- [`workflows/triage.yaml`](workflows/triage.yaml)
- [`workflows/update.yaml`](workflows/update.yaml)

## Coding Standards

Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
uses: "ergebnis/.github/actions/composer/[email protected]"

- name: "Cache dependencies installed with composer"
uses: "actions/[email protected].1"
uses: "actions/[email protected].2"
with:
path: "${{ env.COMPOSER_CACHE_DIR }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
uses: "ergebnis/.github/actions/composer/[email protected]"

- name: "Cache dependencies installed with composer"
uses: "actions/[email protected].1"
uses: "actions/[email protected].2"
with:
path: "${{ env.COMPOSER_CACHE_DIR }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
Expand All @@ -124,7 +124,7 @@ jobs:
run: "mkdir -p .build/php-cs-fixer"

- name: "Cache cache directory for friendsofphp/php-cs-fixer"
uses: "actions/[email protected].1"
uses: "actions/[email protected].2"
with:
path: ".build/php-cs-fixer"
key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ github.ref_name }}"
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:
uses: "ergebnis/.github/actions/composer/[email protected]"

- name: "Cache dependencies installed with composer"
uses: "actions/[email protected].1"
uses: "actions/[email protected].2"
with:
path: "${{ env.COMPOSER_CACHE_DIR }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
Expand Down Expand Up @@ -211,7 +211,7 @@ jobs:
uses: "ergebnis/.github/actions/composer/[email protected]"

- name: "Cache dependencies installed with composer"
uses: "actions/[email protected].1"
uses: "actions/[email protected].2"
with:
path: "${{ env.COMPOSER_CACHE_DIR }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
Expand Down Expand Up @@ -258,7 +258,7 @@ jobs:
uses: "ergebnis/.github/actions/composer/[email protected]"

- name: "Cache dependencies installed with composer"
uses: "actions/[email protected].1"
uses: "actions/[email protected].2"
with:
path: "${{ env.COMPOSER_CACHE_DIR }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
Expand All @@ -273,7 +273,7 @@ jobs:
run: "mkdir -p .build/rector"

- name: "Cache cache directory for rector/rector"
uses: "actions/[email protected].1"
uses: "actions/[email protected].2"
with:
path: ".build/rector"
key: "php-${{ matrix.php-version }}-rector-${{ github.ref_name }}"
Expand Down Expand Up @@ -348,7 +348,7 @@ jobs:
uses: "ergebnis/.github/actions/composer/[email protected]"

- name: "Cache dependencies installed with composer"
uses: "actions/[email protected].1"
uses: "actions/[email protected].2"
with:
path: "${{ env.COMPOSER_CACHE_DIR }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
Expand Down Expand Up @@ -403,7 +403,7 @@ jobs:
uses: "ergebnis/.github/actions/composer/[email protected]"

- name: "Cache dependencies installed with composer"
uses: "actions/[email protected].1"
uses: "actions/[email protected].2"
with:
path: "${{ env.COMPOSER_CACHE_DIR }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/renew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
uses: "ergebnis/.github/actions/composer/[email protected]"

- name: "Cache dependencies installed with composer"
uses: "actions/[email protected].1"
uses: "actions/[email protected].2"
with:
path: "${{ env.COMPOSER_CACHE_DIR }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
Expand All @@ -58,7 +58,7 @@ jobs:
run: "mkdir -p .build/php-cs-fixer"

- name: "Cache cache directory for friendsofphp/php-cs-fixer"
uses: "actions/[email protected].1"
uses: "actions/[email protected].2"
with:
path: ".build/php-cs-fixer"
key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ github.ref_name }}"
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Update"

on: # yamllint disable-line rule:truthy
schedule:
- cron: "0 9 * * *"

jobs:
schema:
name: "Schema"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "8.0"

dependencies:
- "locked"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"

- name: "Set up PHP"
uses: "shivammathur/[email protected]"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"

- name: "Download schema"
run: "wget --output-document=test/Fixture/Vendor/Composer/schema.json https://getcomposer.org/schema.json"

- name: "Show diff"
run: "git diff test/Fixture/Vendor/Composer/schema.json"

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/[email protected]"

- name: "Cache dependencies installed with composer"
uses: "actions/[email protected]"
with:
path: "${{ env.COMPOSER_CACHE_DIR }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install ${{ matrix.dependencies }} dependencies with composer"
uses: "ergebnis/.github/actions/composer/[email protected]"
with:
dependencies: "${{ matrix.dependencies }}"

- name: "Laxify schema"
run: "php bin/laxify-schema.php"

- name: "Open pull request updating schema"
uses: "gr2m/create-or-update-pull-request-action@v1"
with:
author: "ergebnis-bot <[email protected]>"
branch: "feature/schema"
body: |
This PR
- [x] updates `schema.json`
commit-message: "Enhancement: Update schema.json"
path: "resource/"
title: "Enhancement: Update `schema.json`"
env:
GITHUB_TOKEN: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
2 changes: 1 addition & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

/**
* Copyright (c) 2018-2022 Andreas Möller
* Copyright (c) 2018-2023 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source code.
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ For a full diff see [`3.0.0...main`][3.0.0...main].
- Dropped support for PHP 7.4 ([#757]), by [@localheinz]
- Required `ergebnis/json-schema-validator:^4.0.0` ([#771]), by [@localheinz]
- Allowed configuring the `Normalizer\SchemaNormalizer` to exclude properties from being sorted ([#774]), by [@localheinz]
- Adjusted `Vendor\Composer\BinNormalizer`, `Vendor\Composer\PackageHashNormalizer`, `Vendor\Composer\VersionConstraintNormalizer`, and `SchemaNormalizer` to encode JSON with `JSON_PRETTY_PRINT` flag ([#795]), by [@localheinz]
- Adjusted `Vendor\Composer\BinNormalizer`, `Vendor\Composer\PackageHashNormalizer`, `Vendor\Composer\VersionConstraintNormalizer`, and `SchemaNormalizer` to encode JSON with `JSON_UNESCAPED_SLASHES` flag ([#801]), by [@localheinz]
- Adjusted `Vendor\Composer\BinNormalizer`, `Vendor\Composer\PackageHashNormalizer`, `Vendor\Composer\VersionConstraintNormalizer`, and `SchemaNormalizer` to encode JSON with `JSON_UNESCAPED_UNICODE` flag ([#802]), by [@localheinz]
- Adjusted `Vendor\Composer\ComposerJsonNormalizer` to reject JSON when it is not an object ([#804]), by [@localheinz]
- Adjusted `Vendor\Composer\ComposerJsonNormalizer` to compose `WithFinalNewLineNormalizer` ([#806]), by [@localheinz]

### Fixed

Expand All @@ -32,6 +37,7 @@ For a full diff see [`3.0.0...main`][3.0.0...main].
- Removed `Vendor\Composer\ConfigHashNormalizer` ([#775]), by [@localheinz]
- Removed `AutoFormatNormalizer` ([#793]), by [@localheinz]
- Removed `FixedFormatNormalizer` ([#794]), by [@localheinz]
- Inlined and removed `Vendor\Composer\BinNormalizer` ([#805]), by [@localheinz]

## [`3.0.0`][3.0.0]

Expand Down Expand Up @@ -546,6 +552,11 @@ For a full diff see [`5d8b3e2...0.1.0`][5d8b3e2...0.1.0].
[#781]: https://github.com/ergebnis/json-normalizer/pull/781
[#793]: https://github.com/ergebnis/json-normalizer/pull/793
[#794]: https://github.com/ergebnis/json-normalizer/pull/794
[#795]: https://github.com/ergebnis/json-normalizer/pull/795
[#801]: https://github.com/ergebnis/json-normalizer/pull/801
[#802]: https://github.com/ergebnis/json-normalizer/pull/802
[#804]: https://github.com/ergebnis/json-normalizer/pull/804
[#805]: https://github.com/ergebnis/json-normalizer/pull/805

[@BackEndTea]: https://github.com/BackEndTea
[@dependabot]: https://github.com/dependabot
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The MIT License (MIT)

Copyright (c) 2018-2022 Andreas Möller
Copyright (c) 2018-2023 Andreas Möller

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the _Software_), to deal in the Software without restriction, including without limitation the
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ mutation-tests: vendor ## Runs mutation tests with infection/infection
refactoring: vendor ## Runs automated refactoring with rector/rector
vendor/bin/rector process --config=rector.php

.PHONY: schema
schema: vendor ## Updates the schema
wget --output-document=test/Fixture/Vendor/Composer/schema.json https://getcomposer.org/schema.json
php bin/laxify-schema.php

.PHONY: security-analysis
security-analysis: vendor ## Runs a security analysis with composer
composer audit
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[![Release](https://github.com/ergebnis/json-normalizer/workflows/Release/badge.svg)](https://github.com/ergebnis/json-normalizer/actions)
[![Renew](https://github.com/ergebnis/json-normalizer/workflows/Renew/badge.svg)](https://github.com/ergebnis/json-normalizer/actions)
[![Triage](https://github.com/ergebnis/json-normalizer/workflows/Triage/badge.svg)](https://github.com/ergebnis/json-normalizer/actions)
[![Update](https://github.com/ergebnis/json-normalizer/workflows/Update/badge.svg)](https://github.com/ergebnis/json-normalizer/actions)

[![Code Coverage](https://codecov.io/gh/ergebnis/json-normalizer/branch/main/graph/badge.svg)](https://codecov.io/gh/ergebnis/json-normalizer)
[![Type Coverage](https://shepherd.dev/github/ergebnis/json-normalizer/coverage.svg)](https://shepherd.dev/github/ergebnis/json-normalizer)
Expand Down Expand Up @@ -414,13 +415,13 @@ The `Vendor\Composer\ComposerJsonNormalizer` can be used to normalize a `compose

It composes the following normalizers:

- [`Ergebnis\Composer\Json\Normalizer\Vendor\Composer\BinNormalizer`](#vendorcomposerbinnormalizer)
- [`Ergebnis\Composer\Json\Normalizer\Vendor\Composer\PackageHashNormalizer`](#vendorcomposerpackagehashnormalizer)
- [`Ergebnis\Composer\Json\Normalizer\Vendor\Composer\VersionConstraintNormalizer`](#vendorcomposerversionconstraintnormalizer)
- [`Ergebnis\Composer\Json\Normalizer\Vendor\WithFinalNewLineNormalizer`](#withfinalnewlinenormalizer)

#### `Vendor\Composer\BinNormalizer`
#### `bin`

When `composer.json` contains an array of scripts in the `bin` section, the `Vendor\Composer\BinNormalizer` will sort the elements of the `bin` section by value in ascending order.
When `composer.json` contains an array of scripts in the `bin` section, the `Vendor\Composer\ComposerJsonNormalizer` will sort the elements of the `bin` section by value in ascending order.

:bulb: Find out more about the `bin` section at [Composer: The composer.json schema](https://getcomposer.org/doc/04-schema.md#bin).

Expand Down
31 changes: 31 additions & 0 deletions bin/laxify-schema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

/**
* Copyright (c) 2018-2023 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source code.
*
* @see https://github.com/ergebnis/json-normalizer
*/

use Ergebnis\Json\Normalizer\Format;

require_once __DIR__ . '/../vendor/autoload.php';

$schemaFile = __DIR__ . '/../test/Fixture/Vendor/Composer/schema.json';

$schema = \json_decode(
\file_get_contents($schemaFile),
false,
);

$schema->additionalProperties = true;
$schema->required = [];

\file_put_contents($schemaFile, \json_encode(
$schema,
Format\JsonEncodeOptions::default()->toInt(),
));
16 changes: 1 addition & 15 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,9 @@
<code>$schemaDecoded</code>
</MixedAssignment>
</file>
<file src="test/Unit/Vendor/Composer/BinNormalizerTest.php">
<MixedAssignment occurrences="1">
<code>$fileInfo</code>
</MixedAssignment>
</file>
<file src="test/Unit/Vendor/Composer/ComposerJsonNormalizerTest.php">
<MixedAssignment occurrences="1">
<code>$fileInfo</code>
</MixedAssignment>
</file>
<file src="test/Unit/Vendor/Composer/PackageHashNormalizerTest.php">
<MixedAssignment occurrences="1">
<MixedAssignment occurrences="2">
<code>$fileInfo</code>
</MixedAssignment>
</file>
<file src="test/Unit/Vendor/Composer/VersionConstraintNormalizerTest.php">
<MixedAssignment occurrences="1">
<code>$fileInfo</code>
</MixedAssignment>
</file>
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

/**
* Copyright (c) 2018-2022 Andreas Möller
* Copyright (c) 2018-2023 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/CallableNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

/**
* Copyright (c) 2018-2022 Andreas Möller
* Copyright (c) 2018-2023 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/ChainNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

/**
* Copyright (c) 2018-2022 Andreas Möller
* Copyright (c) 2018-2023 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

/**
* Copyright (c) 2018-2022 Andreas Möller
* Copyright (c) 2018-2023 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/InvalidIndentSize.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

/**
* Copyright (c) 2018-2022 Andreas Möller
* Copyright (c) 2018-2023 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/InvalidIndentString.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

/**
* Copyright (c) 2018-2022 Andreas Möller
* Copyright (c) 2018-2023 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/InvalidIndentStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

/**
* Copyright (c) 2018-2022 Andreas Möller
* Copyright (c) 2018-2023 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/InvalidJsonEncodeOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

/**
* Copyright (c) 2018-2022 Andreas Möller
* Copyright (c) 2018-2023 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source code.
Expand Down
Loading

0 comments on commit 1bc7e57

Please sign in to comment.