From 922eac342d3752b3f99d6fabb4a3f968d320b6d2 Mon Sep 17 00:00:00 2001 From: Joby Elliott Date: Thu, 23 Jul 2020 12:05:52 -0600 Subject: [PATCH 1/2] removing incorrect references --- src/DSO.php | 4 ++-- src/DSOFactoryInterface.php | 8 ++++---- src/DSOInterface.php | 4 ++-- src/DriverFactory.php | 2 +- src/Drivers/AbstractDriver.php | 2 +- src/Drivers/DSODriverInterface.php | 2 +- src/Factory.php | 14 +++++++------- src/LegacyDrivers/SQLiteDriver.php | 2 +- src/Search.php | 2 +- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/DSO.php b/src/DSO.php index 85a8b8f..9507984 100644 --- a/src/DSO.php +++ b/src/DSO.php @@ -15,7 +15,7 @@ class DSO extends FlatArray implements DSOInterface protected $changes; protected $removals; - public function __construct(array $data = null, DSOFactoryInterface &$factory = null) + public function __construct(array $data = null, DSOFactoryInterface $factory = null) { $this->resetChanges(); parent::__construct($data); @@ -111,7 +111,7 @@ class DSO extends FlatArray implements DSOInterface } } - public function factory(DSOFactoryInterface &$factory = null) : ?DSOFactoryInterface + public function factory(DSOFactoryInterface $factory = null) : ?DSOFactoryInterface { if ($factory) { $this->factory = $factory; diff --git a/src/DSOFactoryInterface.php b/src/DSOFactoryInterface.php index a16b065..81f2a2f 100644 --- a/src/DSOFactoryInterface.php +++ b/src/DSOFactoryInterface.php @@ -4,16 +4,16 @@ namespace Destructr; interface DSOFactoryInterface { - public function __construct(Drivers\DSODriverInterface &$driver, string $table); + public function __construct(Drivers\DSODriverInterface $driver, string $table); public function class(array $data) : ?string; public function createTable() : bool; public function create(array $data = array()) : DSOInterface; public function read(string $value, string $field = 'dso.id', $deleted = false) : ?DSOInterface; - public function insert(DSOInterface &$dso) : bool; - public function update(DSOInterface &$dso, bool $sneaky = false) : bool; - public function delete(DSOInterface &$dso, bool $permanent = false) : bool; + public function insert(DSOInterface $dso) : bool; + public function update(DSOInterface $dso, bool $sneaky = false) : bool; + public function delete(DSOInterface $dso, bool $permanent = false) : bool; public function quote(string $str) : string; public function search() : Search; diff --git a/src/DSOInterface.php b/src/DSOInterface.php index 926b7e2..281c510 100644 --- a/src/DSOInterface.php +++ b/src/DSOInterface.php @@ -11,8 +11,8 @@ use Flatrr\FlatArrayInterface; */ interface DSOInterface extends FlatArrayInterface { - public function __construct(array $data = null, DSOFactoryInterface &$factory = null); - public function factory(DSOFactoryInterface &$factory = null) : ?DSOFactoryInterface; + public function __construct(array $data = null, DSOFactoryInterface $factory = null); + public function factory(DSOFactoryInterface $factory = null) : ?DSOFactoryInterface; public function set(string $name = null, $value, $force=false); diff --git a/src/DriverFactory.php b/src/DriverFactory.php index 6946bd5..b7dcac2 100644 --- a/src/DriverFactory.php +++ b/src/DriverFactory.php @@ -22,7 +22,7 @@ class DriverFactory } } - public static function factoryFromPDO(\PDO &$pdo, string $type = null) : ?Drivers\DSODriverInterface + public static function factoryFromPDO(\PDO $pdo, string $type = null) : ?Drivers\DSODriverInterface { if (!$type) { $type = $pdo->getAttribute(\PDO::ATTR_DRIVER_NAME); diff --git a/src/Drivers/AbstractDriver.php b/src/Drivers/AbstractDriver.php index 1603f81..2ce68ba 100644 --- a/src/Drivers/AbstractDriver.php +++ b/src/Drivers/AbstractDriver.php @@ -22,7 +22,7 @@ abstract class AbstractDriver implements DSODriverInterface } } - public function &pdo(\PDO &$pdo=null) : ?\PDO + public function pdo(\PDO $pdo=null) : ?\PDO { if ($pdo) { $this->pdo = $pdo; diff --git a/src/Drivers/DSODriverInterface.php b/src/Drivers/DSODriverInterface.php index 9d40b7e..8d8e46b 100644 --- a/src/Drivers/DSODriverInterface.php +++ b/src/Drivers/DSODriverInterface.php @@ -8,7 +8,7 @@ use Destructr\Search; interface DSODriverInterface { public function __construct(string $dsn=null, string $username=null, string $password=null, array $options=null); - public function &pdo(\PDO &$pdo=null) : ?\PDO; + public function pdo(\PDO $pdo=null) : ?\PDO; public function createTable(string $table, array $virtualColumns) : bool; public function select(string $table, Search $search, array $params); diff --git a/src/Factory.php b/src/Factory.php index 3a0deb2..12fea5e 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -73,7 +73,7 @@ class Factory implements DSOFactoryInterface ] ]; - public function __construct(Drivers\DSODriverInterface &$driver, string $table) + public function __construct(Drivers\DSODriverInterface $driver, string $table) { $this->driver = $driver; $this->table = $table; @@ -84,7 +84,7 @@ class Factory implements DSOFactoryInterface return $this->driver->pdo()->quote($str); } - protected function hook_create(DSOInterface &$dso) + protected function hook_create(DSOInterface $dso) { if (!$dso->get('dso.id')) { $dso->set('dso.id', static::generate_id(static::ID_CHARS, static::ID_LENGTH), true); @@ -97,7 +97,7 @@ class Factory implements DSOFactoryInterface } } - protected function hook_update(DSOInterface &$dso) + protected function hook_update(DSOInterface $dso) { $dso->set('dso.modified.date', time()); $dso->set('dso.modified.user', ['ip'=>@$_SERVER['REMOTE_ADDR']]); @@ -108,7 +108,7 @@ class Factory implements DSOFactoryInterface return null; } - public function delete(DSOInterface &$dso, bool $permanent = false) : bool + public function delete(DSOInterface $dso, bool $permanent = false) : bool { if ($permanent) { return $this->driver->delete($this->table, $dso); @@ -117,7 +117,7 @@ class Factory implements DSOFactoryInterface return $this->update($dso, true); } - public function undelete(DSOInterface &$dso) : bool + public function undelete(DSOInterface $dso) : bool { unset($dso['dso.deleted']); return $this->update($dso, true); @@ -153,7 +153,7 @@ class Factory implements DSOFactoryInterface return @$vcols[$path]['name']; } - public function update(DSOInterface &$dso, bool $sneaky = false) : bool + public function update(DSOInterface $dso, bool $sneaky = false) : bool { if (!$dso->changes() && !$dso->removals()) { return true; @@ -221,7 +221,7 @@ class Factory implements DSOFactoryInterface return null; } - public function insert(DSOInterface &$dso) : bool + public function insert(DSOInterface $dso) : bool { $this->hook_update($dso); $dso->hook_update(); diff --git a/src/LegacyDrivers/SQLiteDriver.php b/src/LegacyDrivers/SQLiteDriver.php index cff33f0..54a6b27 100644 --- a/src/LegacyDrivers/SQLiteDriver.php +++ b/src/LegacyDrivers/SQLiteDriver.php @@ -16,7 +16,7 @@ use Destructr\Factory; */ class SQLiteDriver extends AbstractLegacyDriver { - public function &pdo(\PDO &$pdo=null) : ?\PDO + public function pdo(\PDO $pdo=null) : ?\PDO { if ($pdo) { $this->pdo = $pdo; diff --git a/src/Search.php b/src/Search.php index 2bb3a7c..dffd128 100644 --- a/src/Search.php +++ b/src/Search.php @@ -13,7 +13,7 @@ class Search implements \Serializable protected $limit; protected $offset; - public function __construct(DSOFactoryInterface &$factory=null) + public function __construct(DSOFactoryInterface $factory=null) { $this->factory = $factory; } From e088cc47aa9c5131af801630de90202f1b09bc49 Mon Sep 17 00:00:00 2001 From: Joby Elliott Date: Thu, 23 Jul 2020 12:10:17 -0600 Subject: [PATCH 2/2] fixing test --- tests/HarnessDriver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/HarnessDriver.php b/tests/HarnessDriver.php index 633f132..14b196e 100644 --- a/tests/HarnessDriver.php +++ b/tests/HarnessDriver.php @@ -14,7 +14,7 @@ class HarnessDriver implements Drivers\DSODriverInterface { } - public function &pdo(\PDO &$pdo=null) : ?\PDO { + public function pdo(\PDO $pdo=null) : ?\PDO { return null; }