mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-10-24 22:25:09 +03:00
Require PHP 8.2
This commit is contained in:
parent
b5c1be34c2
commit
ddf28c299c
3 changed files with 2 additions and 83 deletions
|
|
@ -1,76 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
if (\PHP_VERSION_ID < 80000)
|
|
||||||
{
|
|
||||||
interface Stringable
|
|
||||||
{
|
|
||||||
public function __toString() : string;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!class_exists('ValueError')) {
|
|
||||||
class ValueError extends Error
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!function_exists('str_contains')) {
|
|
||||||
function str_contains(string $haystack, string $needle) : bool
|
|
||||||
{
|
|
||||||
return false !== strpos($haystack, $needle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!function_exists('str_starts_with')) {
|
|
||||||
function str_starts_with(string $haystack, string $needle) : bool
|
|
||||||
{
|
|
||||||
return 0 === strncmp($haystack, $needle, strlen($needle));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!function_exists('str_ends_with')) {
|
|
||||||
function str_ends_with(string $haystack, string $needle) : bool
|
|
||||||
{
|
|
||||||
$length = strlen($needle);
|
|
||||||
return $length ? substr($haystack, -$length) === $needle : true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!function_exists('get_debug_type')) {
|
|
||||||
function get_debug_type($value): string
|
|
||||||
{
|
|
||||||
$type = gettype($value);
|
|
||||||
switch ($type) {
|
|
||||||
case 'NULL': return 'null';
|
|
||||||
case 'boolean': return 'bool';
|
|
||||||
case 'double': return 'float';
|
|
||||||
case 'integer': return 'int';
|
|
||||||
case 'object':
|
|
||||||
// if ($value instanceof __PHP_Incomplete_Class) return '__PHP_Incomplete_Class';
|
|
||||||
$class = get_class($value);
|
|
||||||
if (false === strpos($class, '@')) {
|
|
||||||
return $class;
|
|
||||||
}
|
|
||||||
$parent = get_parent_class($class);
|
|
||||||
if ($parent) {
|
|
||||||
return $parent . '@anonymous';
|
|
||||||
}
|
|
||||||
$implements = class_implements($class);
|
|
||||||
if ($implements) {
|
|
||||||
return key($implements) . '@anonymous';
|
|
||||||
}
|
|
||||||
return 'class@anonymous';
|
|
||||||
case 'resource':
|
|
||||||
$type = get_resource_type($value);
|
|
||||||
if (null === $type) {
|
|
||||||
return 'unknown';
|
|
||||||
}
|
|
||||||
if ('Unknown' === $type) {
|
|
||||||
$type = 'closed';
|
|
||||||
}
|
|
||||||
return "resource ($type)";
|
|
||||||
default:
|
|
||||||
return $type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -91,8 +91,8 @@ abstract class Integrity
|
||||||
|
|
||||||
public static function phpVersion()
|
public static function phpVersion()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID < 70400) {
|
if (PHP_VERSION_ID < 80200) {
|
||||||
return 'Your PHP version ('.PHP_VERSION.') is lower than the minimal required 7.4.0!';
|
return 'Your PHP version ('.PHP_VERSION.') is lower than the minimal required 8.2.0!';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,6 @@ if (defined('APP_VERSION_ROOT_PATH')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PHP 8
|
|
||||||
if (PHP_VERSION_ID < 80000) {
|
|
||||||
require __DIR__ . '/app/libraries/polyfill/php8.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!extension_loaded('ctype')) {
|
if (!extension_loaded('ctype')) {
|
||||||
require __DIR__ . '/app/libraries/polyfill/ctype.php';
|
require __DIR__ . '/app/libraries/polyfill/ctype.php';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue