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:
38
e107_handlers/Shims/Internal/GetParentClassTrait.php
Normal file
38
e107_handlers/Shims/Internal/GetParentClassTrait.php
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -13,6 +13,7 @@ namespace e107\Shims;
|
||||
|
||||
trait InternalShimsTrait
|
||||
{
|
||||
use Internal\GetParentClassTrait;
|
||||
use Internal\ReadfileTrait;
|
||||
use Internal\StrptimeTrait;
|
||||
}
|
Reference in New Issue
Block a user