Skip to content

Commit

Permalink
Rollback for compatibility with PHP 5.4 - 5.6 😞
Browse files Browse the repository at this point in the history
  • Loading branch information
oliveira131 committed Jul 31, 2021
1 parent 672f231 commit 2e50b2c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 23 deletions.
7 changes: 3 additions & 4 deletions system/engine/front.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
namespace Phacil\Framework;

use Phacil\Framework\Interfaces\Front as frontinterface;
use Phacil\Framework\Interfaces\Action;

use Exception;

Expand Down Expand Up @@ -77,7 +76,7 @@ public function dispatch(\Phacil\Framework\Interfaces\Action $action, $error) {
* @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();
Expand All @@ -96,7 +95,7 @@ private function execute(object $action) {

break;
}
} catch (\Throwable $th) {
} catch (\Exception $th) {
//throw $th;
}
}
Expand All @@ -110,7 +109,7 @@ private function execute(object $action) {
$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);

Expand Down
10 changes: 5 additions & 5 deletions system/engine/interfaces/action.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

/**
*
Expand All @@ -31,11 +31,11 @@ public function getClass():string;
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();
}
2 changes: 0 additions & 2 deletions system/engine/interfaces/front.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

namespace Phacil\Framework\Interfaces;

use Phacil\Framework\Action;
use Phacil\Framework\ActionSystem;

interface Front {

Expand Down
6 changes: 3 additions & 3 deletions system/engine/interfaces/loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public function library($library);
* @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
Expand All @@ -62,7 +62,7 @@ public function controller($control);
* @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
Expand Down
4 changes: 2 additions & 2 deletions system/engine/loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function library($library) {
* @param string $model
* @return void
*/
public function model(string $model) {
public function model($model) {

$parts = explode('/', str_replace('../', '', (string)$model));

Expand Down Expand Up @@ -83,7 +83,7 @@ public function model(string $model) {
* @param string $helper
* @return void
*/
public function helper(string $helper) {
public function helper($helper) {

$parts = explode('/', str_replace('../', '', (string)$helper));

Expand Down
14 changes: 7 additions & 7 deletions system/engine/traits/action.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -70,17 +70,17 @@ public function setClass($class) {
}

/** @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;
}
}

0 comments on commit 2e50b2c

Please sign in to comment.