Skip to content

Commit e68fbbc

Browse files
authored
Merge pull request #45 from boesing/feature/php8.2
Add compatibility PHP 8.2
2 parents 6dd01fd + 024c7da commit e68fbbc

File tree

7 files changed

+43
-60
lines changed

7 files changed

+43
-60
lines changed

.laminas-ci.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"extensions": [
3-
"apcu"
4-
],
52
"ini": [
63
"apc.enable_cli=1"
7-
]
4+
],
5+
"ignore_php_platform_requirements": {
6+
"8.2": true
7+
}
88
}

.laminas-ci/install-apcu-extension-from-source.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
PHP_VERSION="$1"
4+
5+
if ! [[ "${PHP_VERSION}" =~ 8\.2 ]]; then
6+
echo "APCu is only installed from pecl for PHP 8.2, ${PHP_VERSION} detected."
7+
exit 0;
8+
fi
9+
10+
set +e
11+
12+
pecl install --configureoptions 'enable-apcu-debug="no"' apcu
13+
echo "extension=apcu.so" > /etc/php/${PHP_VERSION}/mods-available/apcu.ini
14+
phpenmod -v ${PHP} -s cli apcu

.laminas-ci/pre-install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ JOB=$3
55
PHP_VERSION=$(echo "${JOB}" | jq -r '.php')
66

77
${WORKING_DIRECTORY}/.laminas-ci/composer-root-version.sh || exit 1
8-
${WORKING_DIRECTORY}/.laminas-ci/install-apcu-extension-from-source.sh "${PHP_VERSION}" || exit 1
8+
${WORKING_DIRECTORY}/.laminas-ci/install-apcu-extension-via-pecl.sh "${PHP_VERSION}" || exit 1

composer.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,23 @@
77
],
88
"license": "BSD-3-Clause",
99
"require": {
10-
"php": "^7.4 || ~8.0.0 || ~8.1.0",
10+
"php": "~8.0.0 || ~8.1.0 || ~8.2.0",
1111
"ext-apcu": "^5.1.10",
1212
"laminas/laminas-cache": "^3.0"
1313
},
1414
"provide": {
1515
"laminas/laminas-cache-storage-implementation": "1.0"
1616
},
1717
"require-dev": {
18-
"laminas/laminas-cache": "3.0.x-dev || ^3.0",
19-
"laminas/laminas-cache-storage-adapter-test": "2.0.x-dev || ^2.0",
18+
"laminas/laminas-cache-storage-adapter-test": "^2.0",
2019
"laminas/laminas-coding-standard": "~2.4.0",
2120
"psalm/plugin-phpunit": "^0.18.0",
2221
"vimeo/psalm": "^4.29.0"
2322
},
2423
"config": {
2524
"sort-packages": true,
2625
"platform": {
27-
"php": "7.4.99"
26+
"php": "8.0.99"
2827
},
2928
"allow-plugins": {
3029
"dealerdirect/phpcodesniffer-composer-installer": true

composer.lock

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

src/Apcu.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
use function array_filter;
3030
use function array_keys;
3131
use function ceil;
32-
use function get_class;
3332
use function gettype;
3433
use function implode;
3534
use function ini_get;
@@ -418,7 +417,7 @@ protected function internalSetItem(&$normalizedKey, &$value)
418417
$ttl = (int) ceil($options->getTtl());
419418

420419
if (! apcu_store($internalKey, $value, $ttl)) {
421-
$type = is_object($value) ? get_class($value) : gettype($value);
420+
$type = is_object($value) ? $value::class : gettype($value);
422421
throw new Exception\RuntimeException(
423422
"apcu_store('{$internalKey}', <{$type}>, {$ttl}) failed"
424423
);
@@ -482,7 +481,7 @@ protected function internalAddItem(&$normalizedKey, &$value)
482481
return false;
483482
}
484483

485-
$type = is_object($value) ? get_class($value) : gettype($value);
484+
$type = is_object($value) ? $value::class : gettype($value);
486485
throw new Exception\RuntimeException(
487486
"apcu_add('{$internalKey}', <{$type}>, {$ttl}) failed"
488487
);
@@ -546,7 +545,7 @@ protected function internalReplaceItem(&$normalizedKey, &$value)
546545
}
547546

548547
if (! apcu_store($internalKey, $value, $ttl)) {
549-
$type = is_object($value) ? get_class($value) : gettype($value);
548+
$type = is_object($value) ? $value::class : gettype($value);
550549
throw new Exception\RuntimeException(
551550
"apcu_store('{$internalKey}', <{$type}>, {$ttl}) failed"
552551
);

0 commit comments

Comments
 (0)