Skip to content

Commit

Permalink
Bump to PHP 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Sep 17, 2024
1 parent 731f6e1 commit 139d226
Show file tree
Hide file tree
Showing 90 changed files with 301 additions and 3,157 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ jobs:
strategy:
matrix:
include:
- php: '7.2'
- php: '7.3'
- php: '7.4'
- php: '8.0'
- php: '8.1'
- php: '8.2'
- php: '8.3'
Expand Down
11 changes: 4 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
}
],
"require": {
"php": ">=7.2"
"php": ">=8.1"
},
"require-dev": {
"symfony/intl": "^5.4|^6.4",
"symfony/intl": "^6.4",
"symfony/phpunit-bridge": "^6.4",
"symfony/var-dumper": "^5.4|^6.4"
"symfony/var-dumper": "^6.4"
},
"replace": {
"symfony/polyfill-apcu": "self.version",
Expand Down Expand Up @@ -64,10 +64,7 @@
"src/Intl/Normalizer/Resources/stubs",
"src/Php84/Resources/stubs",
"src/Php83/Resources/stubs",
"src/Php82/Resources/stubs",
"src/Php81/Resources/stubs",
"src/Php80/Resources/stubs",
"src/Php73/Resources/stubs"
"src/Php82/Resources/stubs"
]
},
"minimum-stability": "dev"
Expand Down
2 changes: 1 addition & 1 deletion phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
exit(1);
}
if (!getenv('SYMFONY_PHPUNIT_VERSION')) {
putenv('SYMFONY_PHPUNIT_VERSION=8.5');
putenv('SYMFONY_PHPUNIT_VERSION=9.6');
}

putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
Expand Down
22 changes: 9 additions & 13 deletions src/Apcu/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,37 @@
return;
}

if (\PHP_VERSION_ID >= 80000) {
return require __DIR__.'/bootstrap80.php';
}

if (extension_loaded('Zend Data Cache')) {
if (!function_exists('apcu_add')) {
function apcu_add($key, $value = null, $ttl = 0) { return p\Apcu::apcu_add($key, $value, $ttl); }
function apcu_add($key, mixed $value, ?int $ttl = 0): array|bool { return p\Apcu::apcu_add($key, $value, (int) $ttl); }
}
if (!function_exists('apcu_delete')) {
function apcu_delete($key) { return p\Apcu::apcu_delete($key); }
function apcu_delete($key): array|bool { return p\Apcu::apcu_delete($key); }
}
if (!function_exists('apcu_exists')) {
function apcu_exists($key) { return p\Apcu::apcu_exists($key); }
function apcu_exists($key): array|bool { return p\Apcu::apcu_exists($key); }
}
if (!function_exists('apcu_fetch')) {
function apcu_fetch($key, &$success = null) { return p\Apcu::apcu_fetch($key, $success); }
}
if (!function_exists('apcu_store')) {
function apcu_store($key, $value = null, $ttl = 0) { return p\Apcu::apcu_store($key, $value, $ttl); }
function apcu_store($key, mixed $value, ?int $ttl = 0): array|bool { return p\Apcu::apcu_store($key, $value, (int) $ttl); }
}
} else {
if (!function_exists('apcu_add')) {
function apcu_add($key, $value = null, $ttl = 0) { return apc_add($key, $value, $ttl); }
function apcu_add($key, mixed $value, ?int $ttl = 0): array|bool { return apc_add($key, $value, (int) $ttl); }
}
if (!function_exists('apcu_delete')) {
function apcu_delete($key) { return apc_delete($key); }
function apcu_delete($key): array|bool { return apc_delete($key); }
}
if (!function_exists('apcu_exists')) {
function apcu_exists($key) { return apc_exists($key); }
function apcu_exists($key): array|bool { return apc_exists($key); }
}
if (!function_exists('apcu_fetch')) {
function apcu_fetch($key, &$success = null) { return apc_fetch($key, $success); }
}
if (!function_exists('apcu_store')) {
function apcu_store($key, $value = null, $ttl = 0) { return apc_store($key, $value, $ttl); }
function apcu_store($key, mixed $value, ?int $ttl = 0): array|bool { return apc_store($key, $value, (int) $ttl); }
}
}

Expand All @@ -75,7 +71,7 @@ function apcu_sma_info($limited = false) { return apc_sma_info($limited); }
if (!class_exists('APCuIterator', false) && class_exists('APCIterator', false)) {
class APCuIterator extends APCIterator
{
public function __construct($search = null, $format = \APC_ITER_ALL, $chunk_size = 100, $list = \APC_LIST_ACTIVE)
public function __construct($search = null, $format = APC_ITER_ALL, $chunk_size = 100, $list = APC_LIST_ACTIVE)
{
parent::__construct('user', $search, $format, $chunk_size, $list);
}
Expand Down
75 changes: 0 additions & 75 deletions src/Apcu/bootstrap80.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Apcu/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
],
"require": {
"php": ">=7.2"
"php": ">=8.1"
},
"autoload": {
"psr-4": { "Symfony\\Polyfill\\Apcu\\": "" },
Expand Down
4 changes: 1 addition & 3 deletions src/Ctype/Ctype.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,7 @@ private static function convert_int_to_char_for_ctype($int, $function)
return (string) $int;
}

if (\PHP_VERSION_ID >= 80100) {
@trigger_error($function.'(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED);
}
@trigger_error($function.'(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED);

if ($int < 0) {
$int += 256;
Expand Down
26 changes: 11 additions & 15 deletions src/Ctype/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,36 @@

use Symfony\Polyfill\Ctype as p;

if (\PHP_VERSION_ID >= 80000) {
return require __DIR__.'/bootstrap80.php';
}

if (!function_exists('ctype_alnum')) {
function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
function ctype_alnum(mixed $text): bool { return p\Ctype::ctype_alnum($text); }
}
if (!function_exists('ctype_alpha')) {
function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
function ctype_alpha(mixed $text): bool { return p\Ctype::ctype_alpha($text); }
}
if (!function_exists('ctype_cntrl')) {
function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
function ctype_cntrl(mixed $text): bool { return p\Ctype::ctype_cntrl($text); }
}
if (!function_exists('ctype_digit')) {
function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
function ctype_digit(mixed $text): bool { return p\Ctype::ctype_digit($text); }
}
if (!function_exists('ctype_graph')) {
function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
function ctype_graph(mixed $text): bool { return p\Ctype::ctype_graph($text); }
}
if (!function_exists('ctype_lower')) {
function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
function ctype_lower(mixed $text): bool { return p\Ctype::ctype_lower($text); }
}
if (!function_exists('ctype_print')) {
function ctype_print($text) { return p\Ctype::ctype_print($text); }
function ctype_print(mixed $text): bool { return p\Ctype::ctype_print($text); }
}
if (!function_exists('ctype_punct')) {
function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
function ctype_punct(mixed $text): bool { return p\Ctype::ctype_punct($text); }
}
if (!function_exists('ctype_space')) {
function ctype_space($text) { return p\Ctype::ctype_space($text); }
function ctype_space(mixed $text): bool { return p\Ctype::ctype_space($text); }
}
if (!function_exists('ctype_upper')) {
function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
function ctype_upper(mixed $text): bool { return p\Ctype::ctype_upper($text); }
}
if (!function_exists('ctype_xdigit')) {
function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
function ctype_xdigit(mixed $text): bool { return p\Ctype::ctype_xdigit($text); }
}
46 changes: 0 additions & 46 deletions src/Ctype/bootstrap80.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Ctype/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
],
"require": {
"php": ">=7.2"
"php": ">=8.1"
},
"provide": {
"ext-ctype": "*"
Expand Down
8 changes: 2 additions & 6 deletions src/Iconv/Iconv.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,14 +540,10 @@ public static function iconv_substr($s, $start, $length = 2147483647, $encoding
$start += $slen;
}
if (0 > $start) {
if (\PHP_VERSION_ID < 80000) {
return false;
}

$start = 0;
}
if ($start >= $slen) {
return \PHP_VERSION_ID >= 80000 ? '' : false;
return '';
}

$rx = $slen - $start;
Expand All @@ -559,7 +555,7 @@ public static function iconv_substr($s, $start, $length = 2147483647, $encoding
return '';
}
if (0 > $length) {
return \PHP_VERSION_ID >= 80000 ? '' : false;
return '';
}

if ($length > $rx) {
Expand Down
Loading

0 comments on commit 139d226

Please sign in to comment.