Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to PHP 8.1 #496

Draft
wants to merge 1 commit into
base: 1.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
18 changes: 9 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/5.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
colors="true"
bootstrap="vendor/autoload.php"
>
Expand All @@ -15,15 +15,15 @@
</testsuite>
</testsuites>

<filter>
<whitelist>
<coverage>
<include>
<directory>./src/</directory>
<exclude>
<directory>./src/*/Resources</directory>
<directory>./src/*/*/Resources</directory>
</exclude>
</whitelist>
</filter>
</include>
<exclude>
<directory>./src/*/Resources</directory>
<directory>./src/*/*/Resources</directory>
</exclude>
</coverage>

<listeners>
<listener class="Symfony\Polyfill\Util\TestListener" />
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 @@ -514,14 +514,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 @@ -533,7 +529,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
Loading