Skip to content

Commit

Permalink
feature: add compatibility PHP 8.2
Browse files Browse the repository at this point in the history
This removes support for PHP 7.4

Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
  • Loading branch information
boesing committed Nov 7, 2022
1 parent 74195a2 commit d0b117b
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 93 deletions.
5 changes: 4 additions & 1 deletion .laminas-ci.json
Expand Up @@ -4,5 +4,8 @@
],
"ini": [
"apc.enable_cli=1"
]
],
"ignore_php_platform_requirements": {
"8.2": true
}
}
24 changes: 0 additions & 24 deletions .laminas-ci/install-apcu-extension-from-source.sh

This file was deleted.

15 changes: 15 additions & 0 deletions .laminas-ci/install-apcu-extension-via-pecl.sh
@@ -0,0 +1,15 @@
#!/bin/bash

PHP_VERSION="$1"

if ! [[ "${PHP_VERSION}" =~ 8\.2 ]]; then
echo "APCu is only installed from pecl for PHP 8.2, ${PHP_VERSION} detected."
exit 0;
fi

set +e
apt install make

pecl install --configureoptions 'enable-apcu-debug="no"' apcu
echo "extension=apcu.so" > /etc/php/${PHP_VERSION}/mods-available/apcu.ini
phpenmod -v ${PHP} -s cli apcu
2 changes: 1 addition & 1 deletion .laminas-ci/pre-install.sh
Expand Up @@ -5,4 +5,4 @@ JOB=$3
PHP_VERSION=$(echo "${JOB}" | jq -r '.php')

${WORKING_DIRECTORY}/.laminas-ci/composer-root-version.sh || exit 1
${WORKING_DIRECTORY}/.laminas-ci/install-apcu-extension-from-source.sh "${PHP_VERSION}" || exit 1
${WORKING_DIRECTORY}/.laminas-ci/install-apcu-extension-via-pecl.sh "${PHP_VERSION}" || exit 1
7 changes: 3 additions & 4 deletions composer.json
Expand Up @@ -7,24 +7,23 @@
],
"license": "BSD-3-Clause",
"require": {
"php": "^7.4 || ~8.0.0 || ~8.1.0",
"php": "~8.0.0 || ~8.1.0 || ~8.2.0",
"ext-apcu": "^5.1.10",
"laminas/laminas-cache": "^3.0"
},
"provide": {
"laminas/laminas-cache-storage-implementation": "1.0"
},
"require-dev": {
"laminas/laminas-cache": "3.0.x-dev || ^3.0",
"laminas/laminas-cache-storage-adapter-test": "2.0.x-dev || ^2.0",
"laminas/laminas-cache-storage-adapter-test": "^2.0",
"laminas/laminas-coding-standard": "~2.4.0",
"psalm/plugin-phpunit": "^0.18.0",
"vimeo/psalm": "^4.29.0"
},
"config": {
"sort-packages": true,
"platform": {
"php": "7.4.99"
"php": "8.0.99"
},
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
Expand Down
112 changes: 53 additions & 59 deletions composer.lock

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

7 changes: 3 additions & 4 deletions src/Apcu.php
Expand Up @@ -29,7 +29,6 @@
use function array_filter;
use function array_keys;
use function ceil;
use function get_class;
use function gettype;
use function implode;
use function ini_get;
Expand Down Expand Up @@ -418,7 +417,7 @@ protected function internalSetItem(&$normalizedKey, &$value)
$ttl = (int) ceil($options->getTtl());

if (! apcu_store($internalKey, $value, $ttl)) {
$type = is_object($value) ? get_class($value) : gettype($value);
$type = is_object($value) ? $value::class : gettype($value);
throw new Exception\RuntimeException(
"apcu_store('{$internalKey}', <{$type}>, {$ttl}) failed"
);
Expand Down Expand Up @@ -482,7 +481,7 @@ protected function internalAddItem(&$normalizedKey, &$value)
return false;
}

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

if (! apcu_store($internalKey, $value, $ttl)) {
$type = is_object($value) ? get_class($value) : gettype($value);
$type = is_object($value) ? $value::class : gettype($value);
throw new Exception\RuntimeException(
"apcu_store('{$internalKey}', <{$type}>, {$ttl}) failed"
);
Expand Down

0 comments on commit d0b117b

Please sign in to comment.