1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-29 17:19:56 +02:00

Fix all PHP 8.0 test failures

This commit is contained in:
Nick Liu
2020-11-27 17:00:32 +01:00
parent 072c1b3a90
commit f256b924ce
21 changed files with 103 additions and 34 deletions

View File

@@ -0,0 +1,38 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2020 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
namespace e107\Shims\Internal;
trait GetParentClassTrait
{
/**
* Retrieves the parent class name for object or class
*
* Compatible replacement for PHP internal get_parent_class()
*
* Maintains compatibility with PHP 5.6 while suppressing the TypeError
* thrown by PHP 8.0 if the string provided does not resolve into an extant
* class
*
* @param string|object $object An object or a string that may be a class
* @return false|string The parent class as a string or FALSE otherwise
*/
public static function get_parent_class($object)
{
try
{
return \get_parent_class($object);
}
catch (\Throwable $_)
{
return false;
}
}
}

View File

@@ -13,6 +13,7 @@ namespace e107\Shims;
trait InternalShimsTrait
{
use Internal\GetParentClassTrait;
use Internal\ReadfileTrait;
use Internal\StrptimeTrait;
}