Skip to content

Commit

Permalink
PHP 8.4 compatibility
Browse files Browse the repository at this point in the history
- Allow PHP 8.4
- Fix `Implicitly marking parameter $param as nullable is deprecated`
- Update/patch dependencies to get PHP 8.4 compatibility
  • Loading branch information
cedric-anne committed Sep 4, 2024
1 parent c74bad8 commit 300bfe2
Show file tree
Hide file tree
Showing 27 changed files with 783 additions and 136 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
include:
- {php-version: "8.2"} # Lint on lower PHP version to detected too early usage of new syntaxes
- {php-version: "8.3"} # Lint on higher PHP version to detected deprecated elements usage
- {php-version: "8.4-rc"}
env:
COMPOSE_FILE: ".github/actions/docker-compose-app.yml"
APPLICATION_ROOT: "${{ github.workspace }}"
Expand Down Expand Up @@ -73,9 +74,11 @@ jobs:
run: |
.github/actions/init_show-versions.sh
- name: "Force used PHP version"
# Strip the stability suffix (e.g. "8.4-rc" -> "php:>=8.4")
run: |
REQUIRED_PHP_VERSION="$(echo "${{ matrix.php-version }}" | cut -d '-' -f 1)"
docker compose exec -T app composer config --unset platform.php
docker compose exec -T app composer require "php:>=${{ matrix.php-version }}" --ignore-platform-req=php+ --no-install --no-scripts
docker compose exec -T app composer require "php:>=$REQUIRED_PHP_VERSION" --ignore-platform-req=php+ --no-install --no-scripts
- name: "Build dependencies / translations"
run: |
docker compose exec -T app .github/actions/init_build.sh
Expand Down Expand Up @@ -115,6 +118,7 @@ jobs:
MATRIX='
{
"include": [
{"php-version": "8.4-rc", "db-image": "mariadb:11.4"},
{"php-version": "8.3", "db-image": "mariadb:11.4"},
{"php-version": "8.3", "db-image": "mysql:8.4"},
{"php-version": "8.2", "db-image": "mariadb:11.4"},
Expand All @@ -127,6 +131,7 @@ jobs:
MATRIX='
{
"include": [
{"php-version": "8.4-rc", "db-image": "mariadb:11.4"},
{"php-version": "8.3", "db-image": "mariadb:11.4"},
{"php-version": "8.3", "db-image": "mysql:8.4"}
]
Expand Down
29 changes: 20 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"league/oauth2-server": "^9.0",
"mexitek/phpcolors": "^1.0",
"monolog/monolog": "^3.7",
"paragonie/sodium_compat": "^2.0",
"paragonie/sodium_compat": "^2.1",
"phpdocumentor/reflection-docblock": "^5.4",
"phpoffice/phpspreadsheet": "^2.2",
"psr/cache": "^3.0",
Expand Down Expand Up @@ -99,8 +99,8 @@
},
"require-dev": {
"ext-xml": "*",
"atoum/atoum": "^4.2",
"atoum/stubs": "^2.6",
"atoum/atoum": "dev-main#e43a6a84809635cf5dcdf80bf3c773e7cf1d5a04",
"atoum/stubs": "dev-master#fb8890f347a7ecf1e3cf2b5a139a8b038359a6ab",
"friendsoftwig/twigcs": "^6.4",
"glpi-project/tools": "^0.7",
"mikey179/vfsstream": "^1.6",
Expand Down Expand Up @@ -182,19 +182,30 @@
"post-install-cmd": [
"@php -r \"file_put_contents('.composer.hash', sha1_file('composer.lock'));\"",
"@php -f vendor/bin/build_hw_jsons",
"patch -f -p1 -d vendor/laminas/laminas-mail/ < tools/patches/laminas-mail-invalid-header-ignore.patch || true",
"patch -f -p1 -d vendor/laminas/laminas-mail/ < tools/patches/laminas-mail-address-no-length-check.patch || true",
"patch -f -p1 -d vendor/guzzlehttp/guzzle/ < tools/patches/guzzle-http-client-restrict-http-methods.patch || true"
"@patch"
],
"post-update-cmd": [
"@php -r \"file_put_contents('.composer.hash', sha1_file('composer.lock'));\"",
"@php -f vendor/bin/build_hw_jsons",
"patch -f -p1 -d vendor/laminas/laminas-mail/ < tools/patches/laminas-mail-invalid-header-ignore.patch || true",
"patch -f -p1 -d vendor/laminas/laminas-mail/ < tools/patches/laminas-mail-address-no-length-check.patch || true",
"patch -f -p1 -d vendor/guzzlehttp/guzzle/ < tools/patches/guzzle-http-client-restrict-http-methods.patch || true"
"@patch"
],
"build": [
"bin/console dependencies install && bin/console locales:compile"
],
"patch": [
"patch -f -p1 -d vendor/laminas/laminas-mail/ < tools/patches/laminas-mail-invalid-header-ignore.patch || true",
"patch -f -p1 -d vendor/laminas/laminas-mail/ < tools/patches/laminas-mail-address-no-length-check.patch || true",
"patch -f -p1 -d vendor/guzzlehttp/guzzle/ < tools/patches/guzzle-http-client-restrict-http-methods.patch || true",
"patch -f -p1 -d vendor/apereo/phpcas/ < tools/patches/apereo-phpcas-php84.patch || true",
"patch -f -p1 -d vendor/friendsoftwig/twigcs/ < tools/patches/friendsoftwig-twigcs-php84.patch || true",
"patch -f -p1 -d vendor/league/event/ < tools/patches/league-event-php84.patch || true",
"patch -f -p1 -d vendor/league/oauth2-client/ < tools/patches/league-oauth2-client-php84.patch || true",
"patch -f -p1 -d vendor/league/oauth2-server/ < tools/patches/league-oauth2-server-php84.patch || true",
"patch -f -p1 -d vendor/sabre/dav/ < tools/patches/sabre-dav-php84.patch || true",
"patch -f -p1 -d vendor/swaggest/json-diff/ < tools/patches/swaggest-json-diff-php84.patch || true",
"patch -f -p1 -d vendor/swaggest/json-schema/ < tools/patches/swaggest-json-schema-php84.patch || true",
"patch -f -p1 -d vendor/symfony/cache/ < tools/patches/symfony-cache-php84.patch || true",
"patch -f -p1 -d vendor/wapmorgan/unified-archive/ < tools/patches/wapmorgan-unified-archive-php84.patch || true"
]
}
}
Loading

0 comments on commit 300bfe2

Please sign in to comment.