From 2e50b2c93a83f54581228ca7928f6b5babad4955 Mon Sep 17 00:00:00 2001 From: "Bruno O. Notario" Date: Fri, 30 Jul 2021 22:44:04 -0300 Subject: [PATCH] =?UTF-8?q?Rollback=20for=20compatibility=20with=20PHP=205?= =?UTF-8?q?.4=20-=205.6=20=F0=9F=98=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- system/engine/front.php | 7 +++---- system/engine/interfaces/action.php | 10 +++++----- system/engine/interfaces/front.php | 2 -- system/engine/interfaces/loader.php | 6 +++--- system/engine/loader.php | 4 ++-- system/engine/traits/action.php | 14 +++++++------- 6 files changed, 20 insertions(+), 23 deletions(-) diff --git a/system/engine/front.php b/system/engine/front.php index 6ef124b..9acdd98 100644 --- a/system/engine/front.php +++ b/system/engine/front.php @@ -9,7 +9,6 @@ namespace Phacil\Framework; use Phacil\Framework\Interfaces\Front as frontinterface; -use Phacil\Framework\Interfaces\Action; use Exception; @@ -77,7 +76,7 @@ final class Front implements frontinterface { * @return \Phacil\Framework\Interfaces\Action * @throws Exception */ - private function execute(object $action) { + private function execute($action) { $file = $action->getFile(); $class = $action->getClass(); $classAlt = $action->getClassAlt(); @@ -96,7 +95,7 @@ final class Front implements frontinterface { break; } - } catch (\Throwable $th) { + } catch (\Exception $th) { //throw $th; } } @@ -110,7 +109,7 @@ final class Front implements frontinterface { $this->error = ''; throw new \Exception("The controller can't be loaded", 1); } - } catch (\Throwable $th) { + } catch (\Exception $th) { //throw $th; $action = new Action($this->error); diff --git a/system/engine/interfaces/action.php b/system/engine/interfaces/action.php index 3a18b9c..b675fdd 100644 --- a/system/engine/interfaces/action.php +++ b/system/engine/interfaces/action.php @@ -18,10 +18,10 @@ interface Action { public function __construct($route, $args = array()); /** @return string */ - public function getFile():string; + public function getFile(); /** @return string */ - public function getClass():string; + public function getClass(); /** * @@ -31,11 +31,11 @@ interface Action { public function setClass($class); /** @return array */ - public function getClassAlt():array; + public function getClassAlt(); /** @return string */ - public function getMethod():string; + public function getMethod(); /** @return array */ - public function getArgs():array; + public function getArgs(); } \ No newline at end of file diff --git a/system/engine/interfaces/front.php b/system/engine/interfaces/front.php index 8b9ca3e..c1538dd 100644 --- a/system/engine/interfaces/front.php +++ b/system/engine/interfaces/front.php @@ -8,8 +8,6 @@ namespace Phacil\Framework\Interfaces; -use Phacil\Framework\Action; -use Phacil\Framework\ActionSystem; interface Front { diff --git a/system/engine/interfaces/loader.php b/system/engine/interfaces/loader.php index 31e7742..445b910 100644 --- a/system/engine/interfaces/loader.php +++ b/system/engine/interfaces/loader.php @@ -32,13 +32,13 @@ * @param string $model * @return void */ - public function model(string $model); + public function model($model); /** * @param string $helper * @return void */ - public function helper(string $helper); + public function helper($helper); /** * @param string $control @@ -62,7 +62,7 @@ * @param string|null $charset * @return string[]|string|null */ - public function database(string $driver, $hostname, $username, $password, $database, $port = NULL, $charset = NULL); + public function database($driver, $hostname, $username, $password, $database, $port = NULL, $charset = NULL); /** * @param string $config diff --git a/system/engine/loader.php b/system/engine/loader.php index cd0d931..63457e8 100644 --- a/system/engine/loader.php +++ b/system/engine/loader.php @@ -47,7 +47,7 @@ final class Loader implements \Phacil\Framework\Interfaces\Loader { * @param string $model * @return void */ - public function model(string $model) { + public function model($model) { $parts = explode('/', str_replace('../', '', (string)$model)); @@ -83,7 +83,7 @@ final class Loader implements \Phacil\Framework\Interfaces\Loader { * @param string $helper * @return void */ - public function helper(string $helper) { + public function helper($helper) { $parts = explode('/', str_replace('../', '', (string)$helper)); diff --git a/system/engine/traits/action.php b/system/engine/traits/action.php index 4034c91..71409b5 100644 --- a/system/engine/traits/action.php +++ b/system/engine/traits/action.php @@ -46,17 +46,17 @@ trait Action { private $classAlt = []; /** @return string */ - public function getFile():string { + public function getFile() { return $this->file; } /** @return string */ - public function getClass():string { + public function getClass() { return $this->class; } - private function mountClass(string $namespace, string $class) { - return (defined('NAMESPACE_PREFIX') ? NAMESPACE_PREFIX."\\" : "").str_replace("/", "\\", $namespace)."Controller\\".$class; + private function mountClass($namespace, $class) { + return (defined('NAMESPACE_PREFIX') ? NAMESPACE_PREFIX."\\" : "").str_replace("/", "\\", (string) $namespace)."Controller\\".(string) $class; } /** @@ -70,17 +70,17 @@ trait Action { } /** @return array */ - public function getClassAlt():array { + public function getClassAlt() { return $this->classAlt; } /** @return string */ - public function getMethod():string { + public function getMethod() { return $this->method; } /** @return array */ - public function getArgs():array { + public function getArgs() { return $this->args; } } \ No newline at end of file