Fix types

This commit is contained in:
Dennis Eichhorn 2018-07-15 21:22:25 +02:00
parent 1200350c62
commit a3fd37fd84
3 changed files with 25 additions and 12 deletions

View File

@ -25,6 +25,15 @@ namespace phpOMS\DataStorage;
interface DataStorageConnectionInterface interface DataStorageConnectionInterface
{ {
/**
* Get prefix.
*
* @return string
*
* @since 1.0.0
*/
public function getPrefix() : string;
/** /**
* Connect to datastorage. * Connect to datastorage.
* *

View File

@ -14,7 +14,7 @@ declare(strict_types=1);
namespace phpOMS\DataStorage\Database; namespace phpOMS\DataStorage\Database;
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract; use phpOMS\DataStorage\DataStorageConnectionInterface;
use phpOMS\DataStorage\Database\Query\QueryType; use phpOMS\DataStorage\Database\Query\QueryType;
/** /**
@ -38,7 +38,7 @@ abstract class BuilderAbstract
/** /**
* Database connection. * Database connection.
* *
* @var ConnectionAbstract * @var DataStorageConnectionInterface
* @since 1.0.0 * @since 1.0.0
*/ */
protected $connection = null; protected $connection = null;
@ -68,13 +68,7 @@ abstract class BuilderAbstract
public $raw = ''; public $raw = '';
/** /**
* Set prefix. * {@inheritdoc}
*
* @param string $prefix Prefix
*
* @return self
*
* @since 1.0.0
*/ */
public function prefix(string $prefix) : self public function prefix(string $prefix) : self
{ {

View File

@ -63,7 +63,7 @@ final class Dispatcher
* Dispatch controller. * Dispatch controller.
* *
* @param string|array|\Closure $controller Controller string * @param string|array|\Closure $controller Controller string
* @param array|null ...$data Data * @param array|null|mixed ...$data Data
* *
* @return array * @return array
* *
@ -111,7 +111,12 @@ final class Dispatcher
if (($c = count($dispatch)) === 3) { if (($c = count($dispatch)) === 3) {
/* Handling static functions */ /* Handling static functions */
$function = $dispatch[0] . '::' . $dispatch[2]; $function = $dispatch[0] . '::' . $dispatch[2];
if (!\is_callable($function)) {
throw new \Exception();
}
$views[$controller] = $function(...$data); $views[$controller] = $function(...$data);
} elseif ($c === 2) { } elseif ($c === 2) {
$this->getController($dispatch[0]); $this->getController($dispatch[0]);
@ -135,9 +140,14 @@ final class Dispatcher
*/ */
private function dispatchArray(array $controller, array $data = null) : array private function dispatchArray(array $controller, array $data = null) : array
{ {
$views = []; $views = [];
foreach ($controller as $controllerSingle) { foreach ($controller as $controllerSingle) {
$views += $this->dispatch($controllerSingle, ...$data); if ($data === null) {
$views += $this->dispatch($controllerSingle);
} else {
$views += $this->dispatch($controllerSingle, ...$data);
}
} }
return $views; return $views;