Skip to content

Commit

Permalink
Merge pull request #6811 from getkirby/enhancement/php84
Browse files Browse the repository at this point in the history
[v4] PHP 8.4 support
  • Loading branch information
distantnative authored Dec 9, 2024
2 parents c8af3cb + 4824238 commit 61d3b90
Show file tree
Hide file tree
Showing 140 changed files with 411 additions and 408 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
timeout-minutes: 5
strategy:
matrix:
php: [ "8.1", "8.2", "8.3" ]
php: ["8.1", "8.2", "8.3", "8.4"]
env:
extensions: mbstring, ctype, curl, gd, apcu, memcached
ini: apc.enabled=1, apc.enable_cli=1, pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\""
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
extensions: ${{ env.extensions }}
ini-values: ${{ env.ini }}
coverage: pcov
tools: phpunit:10.5.5, psalm:5.20.0
tools: phpunit:10.5.38, psalm:5.26.1

- name: Setup problem matchers
run: |
Expand All @@ -122,7 +122,7 @@ jobs:
run: phpunit --fail-on-skipped --coverage-clover ${{ github.workspace }}/clover.xml

- name: Statically analyze using Psalm
if: always() && steps.finishPrepare.outcome == 'success'
if: always() && steps.finishPrepare.outcome == 'success' && matrix.php != '8.4'
run: psalm --output-format=github --php-version=${{ matrix.php }} --report=sarif/psalm.sarif --report-show-info=false

- name: Upload coverage results to Codecov
Expand All @@ -139,7 +139,7 @@ jobs:
env_vars: PHP

- name: Upload code scanning results to GitHub
if: always() && steps.finishPrepare.outcome == 'success' && github.repository == 'getkirby/kirby'
if: always() && steps.finishPrepare.outcome == 'success' && github.repository == 'getkirby/kirby' && matrix.php != '8.4'
uses: github/codeql-action/upload-sarif@4a8f20f6b9b5114f354129a1e2f391d75bfd640a # pin@v2
with:
sarif_file: sarif
Expand Down Expand Up @@ -259,7 +259,7 @@ jobs:
with:
php-version: ${{ env.php }}
coverage: none
tools: php-cs-fixer:3.13.0
tools: php-cs-fixer:3.52.1

- name: Cache analysis data
id: finishPrepare
Expand Down
3 changes: 3 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@
'no_unneeded_control_parentheses' => true,
'no_unused_imports' => true,
'no_useless_return' => true,
'nullable_type_declaration' => ['syntax' => 'union'],
'nullable_type_declaration_for_default_null_value' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'ordered_types' => ['sort_algorithm' => 'none', 'null_adjustment' => 'always_last'],
// 'phpdoc_add_missing_param_annotation' => ['only_untyped' => false], // adds params in the wrong order
'phpdoc_align' => ['align' => 'left'],
'phpdoc_indent' => true,
Expand Down
2 changes: 1 addition & 1 deletion bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
if (
version_compare(PHP_VERSION, '8.1.0', '>=') === false ||
version_compare(PHP_VERSION, '8.4.0', '<') === false
version_compare(PHP_VERSION, '8.5.0', '<') === false
) {
die(include __DIR__ . '/views/php.php');
}
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"source": "https://github.com/getkirby/kirby"
},
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
"ext-SimpleXML": "*",
"ext-ctype": "*",
"ext-curl": "*",
Expand All @@ -37,7 +37,7 @@
"ext-mbstring": "*",
"ext-openssl": "*",
"christian-riesen/base32": "1.6.0",
"claviska/simpleimage": "4.2.0",
"claviska/simpleimage": "4.2.1",
"composer/semver": "3.4.3",
"filp/whoops": "2.16.0",
"getkirby/composer-installer": "^1.2.1",
Expand Down
32 changes: 16 additions & 16 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions config/areas/site/searches.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'pages' => [
'label' => I18n::translate('pages'),
'icon' => 'page',
'query' => function (string $query = null, int $limit, int $page) {
'query' => function (string|null $query, int $limit, int $page) {
$kirby = App::instance();
$pages = $kirby->site()
->index(true)
Expand All @@ -31,7 +31,7 @@
'files' => [
'label' => I18n::translate('files'),
'icon' => 'image',
'query' => function (string $query = null, int $limit, int $page) {
'query' => function (string|null $query, int $limit, int $page) {
$kirby = App::instance();
$files = $kirby->site()
->index(true)
Expand Down
2 changes: 1 addition & 1 deletion config/areas/users/searches.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'users' => [
'label' => I18n::translate('users'),
'icon' => 'users',
'query' => function (string $query = null, int $limit, int $page) {
'query' => function (string|null $query, int $limit, int $page) {
$kirby = App::instance();
$users = $kirby->users()
->search($query)
Expand Down
10 changes: 5 additions & 5 deletions config/components.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
*/
'markdown' => function (
App $kirby,
string $text = null,
string|null $text = null,
array $options = []
): string {
static $markdown;
Expand Down Expand Up @@ -230,15 +230,15 @@
$scoring['score'] += 16 * $score;
$scoring['hits'] += 1;

// check for exact beginning matches
// check for exact beginning matches
} elseif (
$options['words'] === false &&
Str::startsWith($lowerValue, $query) === true
) {
$scoring['score'] += 8 * $score;
$scoring['hits'] += 1;

// check for exact query matches
// check for exact query matches
} elseif ($matches = preg_match_all('!' . $exact . '!ui', $value, $r)) {
$scoring['score'] += 2 * $score;
$scoring['hits'] += $matches;
Expand Down Expand Up @@ -270,7 +270,7 @@
*/
'smartypants' => function (
App $kirby,
string $text = null,
string|null $text = null,
array $options = []
): string {
static $smartypants;
Expand Down Expand Up @@ -354,7 +354,7 @@
*/
'url' => function (
App $kirby,
string $path = null,
string|null $path = null,
$options = null
): string {
$language = null;
Expand Down
4 changes: 2 additions & 2 deletions config/fields/checkboxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
/**
* Maximum number of checked boxes
*/
'max' => function (int $max = null) {
'max' => function (int|null $max = null) {
return $max;
},
/**
* Minimum number of checked boxes
*/
'min' => function (int $min = null) {
'min' => function (int|null $min = null) {
return $min;
},
'value' => function ($value = null) {
Expand Down
6 changes: 3 additions & 3 deletions config/fields/date.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* Default date when a new page/file/user gets created
*/
'default' => function (string $default = null): string {
'default' => function (string|null $default = null): string {
return $this->toDatetime($default) ?? '';
},

Expand All @@ -46,13 +46,13 @@
/**
* Latest date, which can be selected/saved (Y-m-d)
*/
'max' => function (string $max = null): string|null {
'max' => function (string|null $max = null): string|null {
return Date::optional($max);
},
/**
* Earliest date, which can be selected/saved (Y-m-d)
*/
'min' => function (string $min = null): string|null {
'min' => function (string|null $min = null): string|null {
return Date::optional($min);
},

Expand Down
2 changes: 1 addition & 1 deletion config/fields/info.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/**
* Change the design of the info box
*/
'theme' => function (string $theme = null) {
'theme' => function (string|null $theme = null) {
return $theme;
}
],
Expand Down
2 changes: 1 addition & 1 deletion config/fields/mixins/datetime.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* Defines a custom format that is used when the field is saved
*/
'format' => function (string $format = null) {
'format' => function (string|null $format = null) {
return $format;
}
],
Expand Down
10 changes: 5 additions & 5 deletions config/fields/mixins/picker.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* Info text for each item
*/
'info' => function (string $info = null) {
'info' => function (string|null $info = null) {
return $info;
},

Expand All @@ -37,14 +37,14 @@
/**
* The minimum number of required selected
*/
'min' => function (int $min = null) {
'min' => function (int|null $min = null) {
return $min;
},

/**
* The maximum number of allowed selected
*/
'max' => function (int $max = null) {
'max' => function (int|null $max = null) {
return $max;
},

Expand All @@ -58,7 +58,7 @@
/**
* Query for the items to be included in the picker
*/
'query' => function (string $query = null) {
'query' => function (string|null $query = null) {
return $query;
},

Expand Down Expand Up @@ -86,7 +86,7 @@
/**
* Main text for each item
*/
'text' => function (string $text = null) {
'text' => function (string|null $text = null) {
return $text;
},
],
Expand Down
2 changes: 1 addition & 1 deletion config/fields/mixins/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
return $map($file, $parent);
});
},
'uploadParent' => function (string $parentQuery = null) {
'uploadParent' => function (string|null $parentQuery = null) {
$parent = $this->model();

if ($parentQuery) {
Expand Down
4 changes: 2 additions & 2 deletions config/fields/number.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
/**
* The lowest allowed number
*/
'min' => function (float $min = null) {
'min' => function (float|null $min = null) {
return $min;
},
/**
* The highest allowed number
*/
'max' => function (float $max = null) {
'max' => function (float|null $max = null) {
return $max;
},
/**
Expand Down
Loading

0 comments on commit 61d3b90

Please sign in to comment.