Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

+16 -11
View File
@@ -11,16 +11,21 @@
namespace IPS\File;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use ReflectionClass;
use RuntimeException;
use function defined;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* File Exception Class
*/
class _Exception extends \RuntimeException
class Exception extends RuntimeException
{
/**
* @brief Cannot open the file
@@ -60,22 +65,22 @@ class _Exception extends \RuntimeException
/**
* @brief File path
*/
public $filepath = NULL;
public ?string $filepath = NULL;
/**
* @brief Original filename (used for friendlier errors)
*/
public $originalFilename = NULL;
public ?string $originalFilename = NULL;
/**
* @brief Additional error information
*/
public $errorMessage = NULL;
public ?string $errorMessage = NULL;
/**
* @brief Additional log information
*/
public $extraLog = NULL;
public ?string $extraLog = NULL;
/**
* Constructor
@@ -87,7 +92,7 @@ class _Exception extends \RuntimeException
* @param string|null $extraLog Error information to log
* @return void
*/
public function __construct( $file, $error, $originalFilename = NULL, $errorMessage = NULL, $extraLog = NULL )
public function __construct( string $file, int $error, ?string $originalFilename = NULL, ?string $errorMessage = NULL, ?string $extraLog = NULL )
{
/* Store the file */
$this->filepath = $file;
@@ -97,7 +102,7 @@ class _Exception extends \RuntimeException
$this->errorMessage = $errorMessage;
$this->extraLog = $extraLog;
$message = array_flip( ( new \ReflectionClass( __CLASS__ ) )->getConstants() )[ $error ];
$message = array_flip( ( new ReflectionClass( __CLASS__ ) )->getConstants() )[ $error ];
parent::__construct( $message, $error );
}
@@ -107,7 +112,7 @@ class _Exception extends \RuntimeException
*
* @return string
*/
public function extraErrorMessage()
public function extraErrorMessage() : string
{
return (string) $this->errorMessage;
}
@@ -117,7 +122,7 @@ class _Exception extends \RuntimeException
*
* @return string
*/
public function extraLogData()
public function extraLogData() : string
{
return (string) $this->extraLog;
}