From 83d33348e0c01739818b79c50c5cac02c269f64f Mon Sep 17 00:00:00 2001 From: n0nag0n Date: Fri, 19 Jan 2024 21:38:30 -0500 Subject: [PATCH] old array syntax cleanup and legacy json serializable removal --- flight/Engine.php | 4 ++-- flight/Flight.php | 2 +- flight/net/Request.php | 4 ++-- flight/util/Collection.php | 4 ---- flight/util/LegacyJsonSerializable.php | 17 ----------------- 5 files changed, 5 insertions(+), 26 deletions(-) delete mode 100644 flight/util/LegacyJsonSerializable.php diff --git a/flight/Engine.php b/flight/Engine.php index 4a1ed3f..bd435c2 100644 --- a/flight/Engine.php +++ b/flight/Engine.php @@ -173,8 +173,8 @@ class Engine $this->before('start', function () use ($self) { // Enable error handling if ($self->get('flight.handle_errors')) { - set_error_handler(array($self, 'handleError')); - set_exception_handler(array($self, 'handleException')); + set_error_handler([$self, 'handleError']); + set_exception_handler([$self, 'handleException']); } // Set case-sensitivity diff --git a/flight/Flight.php b/flight/Flight.php index a24a8f3..39fe83e 100644 --- a/flight/Flight.php +++ b/flight/Flight.php @@ -98,7 +98,7 @@ class Flight * @param ?Closure(T $instance): void $callback Perform actions with the instance * @return void */ - static function register($name, $class, $params = array(), $callback = null) + static function register($name, $class, $params = [], $callback = null) { static::__callStatic('register', func_get_args()); } diff --git a/flight/net/Request.php b/flight/net/Request.php index 99160d7..207df19 100644 --- a/flight/net/Request.php +++ b/flight/net/Request.php @@ -146,7 +146,7 @@ final class Request * * @param array $config Request configuration */ - public function __construct($config = array()) + public function __construct($config = []) { // Default properties if (empty($config)) { @@ -312,7 +312,7 @@ final class Request */ public static function parseQuery(string $url): array { - $params = array(); + $params = []; $args = parse_url($url); if (isset($args['query'])) { diff --git a/flight/util/Collection.php b/flight/util/Collection.php index 01ddb81..39c03bc 100644 --- a/flight/util/Collection.php +++ b/flight/util/Collection.php @@ -15,10 +15,6 @@ use Countable; use Iterator; use JsonSerializable; -if (!interface_exists('JsonSerializable')) { - require_once __DIR__ . '/LegacyJsonSerializable.php'; // @codeCoverageIgnore -} - /** * The Collection class allows you to access a set of data * using both array and object notation. diff --git a/flight/util/LegacyJsonSerializable.php b/flight/util/LegacyJsonSerializable.php deleted file mode 100644 index 39e1721..0000000 --- a/flight/util/LegacyJsonSerializable.php +++ /dev/null @@ -1,17 +0,0 @@ - - * @license MIT, http://flightphp.com/license - */ -interface LegacyJsonSerializable -{ - /** - * Gets the collection data which can be serialized to JSON. - * @return mixed Collection data which can be serialized by json_encode - */ - public function jsonSerialize(); -}