Skip to content

Commit 24700c6

Browse files
committed
feat: PHP 8.5 support
1 parent 44a1a60 commit 24700c6

File tree

15 files changed

+130
-91
lines changed

15 files changed

+130
-91
lines changed

.github/workflows/backend.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
timeout-minutes: 5
5858
strategy:
5959
matrix:
60-
php: ["8.2", "8.3", "8.4"]
60+
php: ["8.2", "8.3", "8.4", "8.5"]
6161
env:
6262
extensions: mbstring, ctype, curl, gd, apcu, memcached, redis
6363
ini: apc.enabled=1, apc.enable_cli=1, pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\""
@@ -127,7 +127,7 @@ jobs:
127127
run: phpunit -c phpunit.ci.xml --coverage-clover ${{ github.workspace }}/clover.xml
128128

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

133133
- name: Upload coverage results to Codecov
@@ -144,7 +144,7 @@ jobs:
144144
env_vars: PHP
145145

146146
- name: Upload code scanning results to GitHub
147-
if: always() && steps.finishPrepare.outcome == 'success' && github.repository == 'getkirby/kirby' && matrix.php != '8.4'
147+
if: always() && steps.finishPrepare.outcome == 'success' && github.repository == 'getkirby/kirby' && matrix.php != '8.5'
148148
uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # pin@v3
149149
with:
150150
sarif_file: sarif

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"source": "https://github.com/getkirby/kirby"
2525
},
2626
"require": {
27-
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
27+
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
2828
"ext-SimpleXML": "*",
2929
"ext-ctype": "*",
3030
"ext-curl": "*",
@@ -37,7 +37,7 @@
3737
"ext-mbstring": "*",
3838
"ext-openssl": "*",
3939
"christian-riesen/base32": "1.6.0",
40-
"claviska/simpleimage": "4.2.1",
40+
"claviska/simpleimage": "4.3.0",
4141
"composer/semver": "3.4.4",
4242
"filp/whoops": "2.18.4",
4343
"getkirby/composer-installer": "^1.2.1",

composer.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dependencies/spyc/Spyc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* into a PHP array. It currently supports a very limited subsection of
88
* the YAML spec.
99
*
10-
* @version 0.6.3 (Kirby fork for PHP 8.1+)
10+
* @version 0.6.4 (Kirby fork for PHP 8.5+)
1111
* @author Vlad Andersen <[email protected]>
1212
* @author Chris Wanstrath <[email protected]>
1313
* @link https://github.com/mustangostang/spyc/
@@ -877,7 +877,7 @@ private function addArray($incoming_data, $incoming_indent)
877877
return $this->addArrayInline($incoming_data, $incoming_indent);
878878

879879
$key = key($incoming_data);
880-
$value = isset($incoming_data[$key]) ? $incoming_data[$key] : null;
880+
$value = $key !== null && isset($incoming_data[$key]) ? $incoming_data[$key] : null;
881881
if ($key === '__!YAMLZero') $key = '0';
882882

883883
if ($incoming_indent == 0 && !$this->_containsGroupAlias && !$this->_containsGroupAnchor) { // Shortcut for root-level values.

src/Cms/Email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ protected function transformUserSingle(
213213
$result = $this->transformModel($addressProp, User::class, 'name', 'email');
214214

215215
$address = array_keys($result)[0] ?? null;
216-
$name = $result[$address] ?? null;
216+
$name = $address !== null ? ($result[$address] ?? null) : null;
217217

218218
// if the array is non-associative, the value is the address
219219
if (is_int($address) === true) {

src/Cms/PageActions.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,14 @@ public function createChild(array $props): Page
498498
'site' => $this->site(),
499499
];
500500

501-
$modelClass = static::$models[$props['template'] ?? null] ?? static::class;
502-
return $modelClass::create($props);
501+
if (
502+
($template = $props['template'] ?? null) &&
503+
($model = static::$models[$template] ?? null)
504+
) {
505+
return $model::create($props);
506+
}
507+
508+
return static::create($props);
503509
}
504510

505511
/**

src/Filesystem/Mime.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ public static function fix(
125125
string|null $mime = null,
126126
string|null $extension = null
127127
): string|null {
128+
if ($mime === null || $extension === null) {
129+
return $mime;
130+
}
131+
128132
// fixing map
129133
$map = [
130134
'text/html' => [

src/Panel/Lab/Example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(
4444

4545
public function collectTab(string|null $tab): string|null
4646
{
47-
if ($this->tabs === []) {
47+
if ($this->tabs === [] || $tab === null) {
4848
return null;
4949
}
5050

src/Panel/Panel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public static function router(string|null $path = null): Response|null
321321
$auth = $route->attributes()['auth'] ?? true;
322322
$areaId = $route->attributes()['area'] ?? null;
323323
$type = $route->attributes()['type'] ?? 'view';
324-
$area = $areas[$areaId] ?? null;
324+
$area = $areaId !== null ? ($areas[$areaId] ?? null) : null;
325325

326326
// call the route action to check the result
327327
try {

src/Plugin/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public function version(): string|null
330330
try {
331331
// try to get version from "vendor/composer/installed.php",
332332
// this is the most reliable source for the version
333-
$version = InstalledVersions::getPrettyVersion($name);
333+
$version = $name !== null ? InstalledVersions::getPrettyVersion($name) : null;
334334
} catch (Throwable) {
335335
$version = null;
336336
}

0 commit comments

Comments
 (0)