Skip to content

Commit

Permalink
Merge pull request #1278 from ergebnis/feature/php80
Browse files Browse the repository at this point in the history
Enhancement: Add support for PHP 8.0
  • Loading branch information
localheinz committed Jan 30, 2024
2 parents 69cf31e + e407029 commit 9c5a8fe
Show file tree
Hide file tree
Showing 44 changed files with 890 additions and 1,300 deletions.
12 changes: 0 additions & 12 deletions .github/CONTRIBUTING.md
Expand Up @@ -11,18 +11,6 @@ For details, take a look at the following workflow configuration files:
- [`workflows/triage.yaml`](workflows/triage.yaml)
- [`workflows/update.yaml`](workflows/update.yaml)

## Backward-Compatibility Analysis

We use [`roave/backward-compatibility-check`](https://github.com/Roave/BackwardCompatibilityCheck) to prevent breaking backwards-compatibility.

Run

```sh
make backward-compatibility-analysis
```

to run a backward-compatibility analysis.

## Coding Standards

We use [`ergebnis/composer-normalize`](https://github.com/ergebnis/composer-normalize) to normalize `composer.json`.
Expand Down
20 changes: 11 additions & 9 deletions .github/settings.yml
Expand Up @@ -14,15 +14,17 @@ branches:
required_approving_review_count: 1
required_status_checks:
checks:
- context: "Backward-Compatibility Analysis (8.1, locked)"
- context: "Code Coverage (8.1, locked)"
- context: "Coding Standards (8.1, locked)"
- context: "Compile Phar (8.1, locked)"
- context: "Dependency Analysis (8.1, locked)"
- context: "Mutation Tests (8.1, locked)"
- context: "Refactoring (8.1, locked)"
- context: "Security Analysis (8.1, locked)"
- context: "Static Code Analysis (8.1, locked)"
- context: "Code Coverage (8.0, locked)"
- context: "Coding Standards (8.0, locked)"
- context: "Compile Phar (8.0, locked)"
- context: "Dependency Analysis (8.0, locked)"
- context: "Mutation Tests (8.0, locked)"
- context: "Refactoring (8.0, locked)"
- context: "Security Analysis (8.0, locked)"
- context: "Static Code Analysis (8.0, locked)"
- context: "Tests (8.0, highest)"
- context: "Tests (8.0, locked)"
- context: "Tests (8.0, lowest)"
- context: "Tests (8.1, highest)"
- context: "Tests (8.1, locked)"
- context: "Tests (8.1, lowest)"
Expand Down
87 changes: 18 additions & 69 deletions .github/workflows/integrate.yaml
Expand Up @@ -9,58 +9,6 @@ on: # yamllint disable-line rule:truthy
- "main"

jobs:
backward-compatibility-analysis:
name: "Backward-Compatibility Analysis"

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
- "8.1"

dependencies:
- "locked"

steps:
- name: "Checkout"
uses: "actions/checkout@v4.1.1"
with:
fetch-depth: 0

- name: "Set up PHP"
uses: "shivammathur/setup-php@2.29.0"
with:
coverage: "none"
extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""

- name: "Validate composer.json and composer.lock"
run: "composer validate --ansi --strict"

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.0"

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v4.0.0"
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/install@1.9.0"
with:
dependencies: "${{ matrix.dependencies }}"

- name: "Run backward-compatibility analysis with roave/backward-compatibility-check"
run: "vendor/bin/roave-backward-compatibility-check --ansi --format=github-actions --install-development-dependencies"

code-coverage:
name: "Code Coverage"

Expand All @@ -71,7 +19,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand All @@ -84,7 +32,7 @@ jobs:
uses: "shivammathur/setup-php@2.29.0"
with:
coverage: "xdebug"
extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
Expand Down Expand Up @@ -132,7 +80,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand All @@ -152,7 +100,7 @@ jobs:
uses: "shivammathur/setup-php@2.29.0"
with:
coverage: "none"
extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"
tools: "phive"

Expand Down Expand Up @@ -207,7 +155,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand All @@ -224,7 +172,7 @@ jobs:
uses: "shivammathur/setup-php@2.29.0"
with:
coverage: "none"
extensions: "none, bcmath, ctype, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
ini-values: "memory_limit=-1, phar.readonly=0"
php-version: "${{ matrix.php-version }}"
tools: "phive"
Expand Down Expand Up @@ -283,7 +231,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand All @@ -296,7 +244,7 @@ jobs:
uses: "shivammathur/setup-php@2.29.0"
with:
coverage: "none"
extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"
tools: "phive"

Expand Down Expand Up @@ -339,7 +287,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand All @@ -352,7 +300,7 @@ jobs:
uses: "shivammathur/setup-php@2.29.0"
with:
coverage: "xdebug"
extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
Expand Down Expand Up @@ -391,7 +339,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand All @@ -404,7 +352,7 @@ jobs:
uses: "shivammathur/setup-php@2.29.0"
with:
coverage: "none"
extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
Expand Down Expand Up @@ -450,7 +398,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand All @@ -463,7 +411,7 @@ jobs:
uses: "shivammathur/setup-php@2.29.0"
with:
coverage: "none"
extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
Expand Down Expand Up @@ -500,7 +448,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand All @@ -513,7 +461,7 @@ jobs:
uses: "shivammathur/setup-php@2.29.0"
with:
coverage: "none"
extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, opcache, pcntl, phar, posix, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, opcache, pcntl, phar, posix, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
Expand Down Expand Up @@ -551,6 +499,7 @@ jobs:
fail-fast: false
matrix:
php-version:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
Expand All @@ -568,7 +517,7 @@ jobs:
uses: "shivammathur/setup-php@2.29.0"
with:
coverage: "none"
extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand All @@ -38,7 +38,7 @@ jobs:
uses: "shivammathur/setup-php@2.29.0"
with:
coverage: "none"
extensions: "none, bcmath, ctype, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"
tools: "phive"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/renew.yaml
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand All @@ -32,7 +32,7 @@ jobs:
uses: "shivammathur/setup-php@2.29.0"
with:
coverage: "none"
extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update.yaml
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

steps:
- name: "Checkout"
Expand Down
6 changes: 3 additions & 3 deletions .phive/phars.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="composer-normalize" version="^2.41.1" installed="2.41.1" location="./.phive/composer-normalize" copy="false"/>
<phar name="composer-require-checker" version="^4.7.1" installed="4.7.1" location="./.phive/composer-require-checker" copy="false"/>
<phar name="humbug/box" version="^4.5.0" installed="4.5.0" location="./.phive/box" copy="false"/>
<phar name="composer-normalize" version="^2.31.0" installed="2.31.0" location="./.phive/composer-normalize" copy="false"/>
<phar name="composer-require-checker" version="^4.4.0" installed="4.4.0" location="./.phive/composer-require-checker" copy="false"/>
<phar name="humbug/box" version="^3.16.0" installed="3.16.0" location="./.phive/box" copy="false"/>
</phive>
2 changes: 1 addition & 1 deletion .php-cs-fixer.php
Expand Up @@ -26,7 +26,7 @@

$license->save();

$ruleSet = PhpCsFixer\Config\RuleSet\Php81::create()
$ruleSet = PhpCsFixer\Config\RuleSet\Php80::create()
->withHeader($license->header())
->withRules(PhpCsFixer\Config\Rules::fromArray([
'no_useless_concat_operator' => false,
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -13,6 +13,7 @@ For a full diff see [`2.41.1...main`][2.41.1...main].
- Required `ergebnis/json:^1.2.0` ([#1273]), by [@dependabot]
- Required `ergebnis/json-printer:^3.5.0` ([#1275]), by [@dependabot]
- Required `ergebnis/json-normalizer:^4.5.0` ([#1277]), by [@localheinz]
- Added support for PHP 8.0 ([#1278]), by [@localheinz]

## [`2.41.1`][2.41.1]

Expand Down Expand Up @@ -1211,6 +1212,7 @@ For a full diff see [`81bc3a8...0.1.0`][81bc3a8...0.1.0].
[#1273]: https://github.com/ergebnis/composer-normalize/pull/1273
[#1275]: https://github.com/ergebnis/composer-normalize/pull/1275
[#1277]: https://github.com/ergebnis/composer-normalize/pull/1277
[#1278]: https://github.com/ergebnis/composer-normalize/pull/1278

[@core23]: https://github.com/core23
[@dependabot]: https://github.com/dependabot
Expand Down
4 changes: 0 additions & 4 deletions Makefile
Expand Up @@ -3,10 +3,6 @@ COMPOSER_VERSION:=2.6.6
.PHONY: it
it: refactoring coding-standards security-analysis static-code-analysis tests ## Runs the refactoring, coding-standards, security-analysis, static-code-analysis, and tests targets

.PHONY: backward-compatibility-analysis
backward-compatibility-analysis: vendor ## Runs a backward-compatibility analysis with roave/backward-compatibility-check
vendor/bin/roave-backward-compatibility-check --install-development-dependencies

.PHONY: code-coverage
code-coverage: vendor ## Collects coverage from running unit and integration tests with phpunit/phpunit
vendor/bin/phpunit --configuration=test/phpunit.xml --coverage-text
Expand Down
15 changes: 7 additions & 8 deletions composer.json
Expand Up @@ -23,7 +23,7 @@
"security": "https://github.com/ergebnis/composer-normalize/blob/main/.github/SECURITY.md"
},
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
"ext-json": "*",
"composer-plugin-api": "^2.0.0",
"ergebnis/json": "^1.2.0",
Expand All @@ -35,15 +35,14 @@
"require-dev": {
"composer/composer": "^2.6.6",
"ergebnis/license": "^2.4.0",
"ergebnis/php-cs-fixer-config": "~6.20.0",
"ergebnis/php-cs-fixer-config": "^6.20.0",
"ergebnis/phpunit-slow-test-detector": "^2.9.0",
"fakerphp/faker": "^1.23.1",
"infection/infection": "~0.27.9",
"phpunit/phpunit": "^10.5.9",
"infection/infection": "~0.26.19",
"phpunit/phpunit": "^9.6.16",
"psalm/plugin-phpunit": "~0.18.4",
"rector/rector": "~0.19.5",
"roave/backward-compatibility-check": "^8.6.0",
"symfony/filesystem": "^6.4.0",
"rector/rector": "~0.19.2",
"symfony/filesystem": "^6.0.19",
"vimeo/psalm": "^5.20.0"
},
"minimum-stability": "dev",
Expand All @@ -67,7 +66,7 @@
"abandoned": "report"
},
"platform": {
"php": "8.1.26"
"php": "8.0.30"
},
"preferred-install": "dist",
"sort-packages": true
Expand Down

0 comments on commit 9c5a8fe

Please sign in to comment.