diff --git a/src/Dibi/Connection.php b/src/Dibi/Connection.php index a01fb91c..fceeda0f 100644 --- a/src/Dibi/Connection.php +++ b/src/Dibi/Connection.php @@ -97,7 +97,7 @@ class Connection $this->config = $config; // profiler - $profilerCfg = & $config['profiler']; + $profilerCfg = &$config['profiler']; if (is_scalar($profilerCfg)) { $profilerCfg = ['run' => (bool) $profilerCfg]; } @@ -204,7 +204,7 @@ class Connection /** @deprecated */ - public static function alias(& $config, $key, $alias) + public static function alias(&$config, $key, $alias) { trigger_error(__METHOD__ . '() is deprecated, use Helpers::alias().', E_USER_DEPRECATED); Helpers::alias($config, $key, $alias); diff --git a/src/Dibi/Drivers/FirebirdDriver.php b/src/Dibi/Drivers/FirebirdDriver.php index 3c44d268..401d8db5 100644 --- a/src/Dibi/Drivers/FirebirdDriver.php +++ b/src/Dibi/Drivers/FirebirdDriver.php @@ -60,7 +60,7 @@ class FirebirdDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector * @return void * @throws Dibi\Exception */ - public function connect(array & $config) + public function connect(array &$config) { Dibi\Helpers::alias($config, 'database', 'db'); @@ -331,7 +331,7 @@ class FirebirdDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector * Injects LIMIT/OFFSET to the SQL query. * @return void */ - public function applyLimit(& $sql, $limit, $offset) + public function applyLimit(&$sql, $limit, $offset) { if ($limit > 0 || $offset > 0) { // http://www.firebirdsql.org/refdocs/langrefupd20-select.html diff --git a/src/Dibi/Drivers/MsSqlDriver.php b/src/Dibi/Drivers/MsSqlDriver.php index 0713daef..29ad3302 100644 --- a/src/Dibi/Drivers/MsSqlDriver.php +++ b/src/Dibi/Drivers/MsSqlDriver.php @@ -52,7 +52,7 @@ class MsSqlDriver implements Dibi\Driver, Dibi\ResultDriver * @return void * @throws Dibi\Exception */ - public function connect(array & $config) + public function connect(array &$config) { if (isset($config['resource'])) { $this->connection = $config['resource']; @@ -282,7 +282,7 @@ class MsSqlDriver implements Dibi\Driver, Dibi\ResultDriver * Injects LIMIT/OFFSET to the SQL query. * @return void */ - public function applyLimit(& $sql, $limit, $offset) + public function applyLimit(&$sql, $limit, $offset) { if ($offset) { throw new Dibi\NotSupportedException('Offset is not supported by this database.'); diff --git a/src/Dibi/Drivers/MySqlDriver.php b/src/Dibi/Drivers/MySqlDriver.php index 976d0279..d7d8a0c9 100644 --- a/src/Dibi/Drivers/MySqlDriver.php +++ b/src/Dibi/Drivers/MySqlDriver.php @@ -65,7 +65,7 @@ class MySqlDriver implements Dibi\Driver, Dibi\ResultDriver * @return void * @throws Dibi\Exception */ - public function connect(array & $config) + public function connect(array &$config) { if (isset($config['resource'])) { $this->connection = $config['resource']; @@ -367,7 +367,7 @@ class MySqlDriver implements Dibi\Driver, Dibi\ResultDriver * Injects LIMIT/OFFSET to the SQL query. * @return void */ - public function applyLimit(& $sql, $limit, $offset) + public function applyLimit(&$sql, $limit, $offset) { if ($limit < 0 || $offset < 0) { throw new Dibi\NotSupportedException('Negative offset or limit.'); diff --git a/src/Dibi/Drivers/MySqliDriver.php b/src/Dibi/Drivers/MySqliDriver.php index 060fc7ad..4b762351 100644 --- a/src/Dibi/Drivers/MySqliDriver.php +++ b/src/Dibi/Drivers/MySqliDriver.php @@ -66,7 +66,7 @@ class MySqliDriver implements Dibi\Driver, Dibi\ResultDriver * @return void * @throws Dibi\Exception */ - public function connect(array & $config) + public function connect(array &$config) { mysqli_report(MYSQLI_REPORT_OFF); if (isset($config['resource'])) { @@ -93,8 +93,8 @@ class MySqliDriver implements Dibi\Driver, Dibi\ResultDriver } } - $foo = & $config['flags']; - $foo = & $config['database']; + $foo = &$config['flags']; + $foo = &$config['database']; $this->connection = mysqli_init(); if (isset($config['options'])) { @@ -375,7 +375,7 @@ class MySqliDriver implements Dibi\Driver, Dibi\ResultDriver * Injects LIMIT/OFFSET to the SQL query. * @return void */ - public function applyLimit(& $sql, $limit, $offset) + public function applyLimit(&$sql, $limit, $offset) { if ($limit < 0 || $offset < 0) { throw new Dibi\NotSupportedException('Negative offset or limit.'); diff --git a/src/Dibi/Drivers/OdbcDriver.php b/src/Dibi/Drivers/OdbcDriver.php index 33fa3a20..ee7079a6 100644 --- a/src/Dibi/Drivers/OdbcDriver.php +++ b/src/Dibi/Drivers/OdbcDriver.php @@ -57,7 +57,7 @@ class OdbcDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector * @return void * @throws Dibi\Exception */ - public function connect(array & $config) + public function connect(array &$config) { if (isset($config['resource'])) { $this->connection = $config['resource']; @@ -306,7 +306,7 @@ class OdbcDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector * Injects LIMIT/OFFSET to the SQL query. * @return void */ - public function applyLimit(& $sql, $limit, $offset) + public function applyLimit(&$sql, $limit, $offset) { if ($offset) { throw new Dibi\NotSupportedException('Offset is not supported by this database.'); diff --git a/src/Dibi/Drivers/OracleDriver.php b/src/Dibi/Drivers/OracleDriver.php index 5c87019f..8109da72 100644 --- a/src/Dibi/Drivers/OracleDriver.php +++ b/src/Dibi/Drivers/OracleDriver.php @@ -64,9 +64,9 @@ class OracleDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector * @return void * @throws Dibi\Exception */ - public function connect(array & $config) + public function connect(array &$config) { - $foo = & $config['charset']; + $foo = &$config['charset']; $this->fmtDate = isset($config['formatDate']) ? $config['formatDate'] : 'U'; $this->fmtDateTime = isset($config['formatDateTime']) ? $config['formatDateTime'] : 'U'; @@ -331,7 +331,7 @@ class OracleDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector * Injects LIMIT/OFFSET to the SQL query. * @return void */ - public function applyLimit(& $sql, $limit, $offset) + public function applyLimit(&$sql, $limit, $offset) { if ($limit < 0 || $offset < 0) { throw new Dibi\NotSupportedException('Negative offset or limit.'); diff --git a/src/Dibi/Drivers/PdoDriver.php b/src/Dibi/Drivers/PdoDriver.php index 2cab7fea..075b95fd 100644 --- a/src/Dibi/Drivers/PdoDriver.php +++ b/src/Dibi/Drivers/PdoDriver.php @@ -59,10 +59,10 @@ class PdoDriver implements Dibi\Driver, Dibi\ResultDriver * @return void * @throws Dibi\Exception */ - public function connect(array & $config) + public function connect(array &$config) { - $foo = & $config['dsn']; - $foo = & $config['options']; + $foo = &$config['dsn']; + $foo = &$config['options']; Dibi\Helpers::alias($config, 'resource', 'pdo'); if ($config['resource'] instanceof PDO) { @@ -396,7 +396,7 @@ class PdoDriver implements Dibi\Driver, Dibi\ResultDriver * Injects LIMIT/OFFSET to the SQL query. * @return void */ - public function applyLimit(& $sql, $limit, $offset) + public function applyLimit(&$sql, $limit, $offset) { if ($limit < 0 || $offset < 0) { throw new Dibi\NotSupportedException('Negative offset or limit.'); diff --git a/src/Dibi/Drivers/PostgreDriver.php b/src/Dibi/Drivers/PostgreDriver.php index ade94aa6..463ff3e7 100644 --- a/src/Dibi/Drivers/PostgreDriver.php +++ b/src/Dibi/Drivers/PostgreDriver.php @@ -55,7 +55,7 @@ class PostgreDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector * @return void * @throws Dibi\Exception */ - public function connect(array & $config) + public function connect(array &$config) { $error = NULL; if (isset($config['resource'])) { @@ -78,7 +78,7 @@ class PostgreDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector } } - set_error_handler(function($severity, $message) use (& $error) { + set_error_handler(function($severity, $message) use (&$error) { $error = $message; }); if (empty($config['persistent'])) { @@ -382,7 +382,7 @@ class PostgreDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector * Injects LIMIT/OFFSET to the SQL query. * @return void */ - public function applyLimit(& $sql, $limit, $offset) + public function applyLimit(&$sql, $limit, $offset) { if ($limit < 0 || $offset < 0) { throw new Dibi\NotSupportedException('Negative offset or limit.'); diff --git a/src/Dibi/Drivers/Sqlite3Driver.php b/src/Dibi/Drivers/Sqlite3Driver.php index bf0fa9b5..980d58c7 100644 --- a/src/Dibi/Drivers/Sqlite3Driver.php +++ b/src/Dibi/Drivers/Sqlite3Driver.php @@ -59,7 +59,7 @@ class Sqlite3Driver implements Dibi\Driver, Dibi\ResultDriver * @return void * @throws Dibi\Exception */ - public function connect(array & $config) + public function connect(array &$config) { Dibi\Helpers::alias($config, 'database', 'file'); $this->fmtDate = isset($config['formatDate']) ? $config['formatDate'] : 'U'; @@ -326,7 +326,7 @@ class Sqlite3Driver implements Dibi\Driver, Dibi\ResultDriver * Injects LIMIT/OFFSET to the SQL query. * @return void */ - public function applyLimit(& $sql, $limit, $offset) + public function applyLimit(&$sql, $limit, $offset) { if ($limit < 0 || $offset < 0) { throw new Dibi\NotSupportedException('Negative offset or limit.'); diff --git a/src/Dibi/Drivers/SqlsrvDriver.php b/src/Dibi/Drivers/SqlsrvDriver.php index 2ccd1732..3e6192e2 100644 --- a/src/Dibi/Drivers/SqlsrvDriver.php +++ b/src/Dibi/Drivers/SqlsrvDriver.php @@ -61,7 +61,7 @@ class SqlsrvDriver implements Dibi\Driver, Dibi\ResultDriver * @return void * @throws Dibi\Exception */ - public function connect(array & $config) + public function connect(array &$config) { Helpers::alias($config, 'options|UID', 'username'); Helpers::alias($config, 'options|PWD', 'password'); @@ -306,7 +306,7 @@ class SqlsrvDriver implements Dibi\Driver, Dibi\ResultDriver * Injects LIMIT/OFFSET to the SQL query. * @return void */ - public function applyLimit(& $sql, $limit, $offset) + public function applyLimit(&$sql, $limit, $offset) { if ($limit < 0 || $offset < 0) { throw new Dibi\NotSupportedException('Negative offset or limit.'); diff --git a/src/Dibi/Fluent.php b/src/Dibi/Fluent.php index d6f48417..ab095e5a 100644 --- a/src/Dibi/Fluent.php +++ b/src/Dibi/Fluent.php @@ -130,19 +130,19 @@ class Fluent implements IDataSource if (isset(self::$masks[$clause])) { $this->clauses = array_fill_keys(self::$masks[$clause], NULL); } - $this->cursor = & $this->clauses[$clause]; + $this->cursor = &$this->clauses[$clause]; $this->cursor = []; $this->command = $clause; } // auto-switch to a clause if (isset(self::$clauseSwitches[$clause])) { - $this->cursor = & $this->clauses[self::$clauseSwitches[$clause]]; + $this->cursor = &$this->clauses[self::$clauseSwitches[$clause]]; } if (array_key_exists($clause, $this->clauses)) { // append to clause - $this->cursor = & $this->clauses[$clause]; + $this->cursor = &$this->clauses[$clause]; // TODO: really delete? if ($args === [self::REMOVE]) { @@ -211,7 +211,7 @@ class Fluent implements IDataSource */ public function clause($clause) { - $this->cursor = & $this->clauses[self::$normalizer->$clause]; + $this->cursor = &$this->clauses[self::$normalizer->$clause]; if ($this->cursor === NULL) { $this->cursor = []; } @@ -512,10 +512,10 @@ class Fluent implements IDataSource { // remove references foreach ($this->clauses as $clause => $val) { - $this->clauses[$clause] = & $val; + $this->clauses[$clause] = &$val; unset($val); } - $this->cursor = & $foo; + $this->cursor = &$foo; } } diff --git a/src/Dibi/Helpers.php b/src/Dibi/Helpers.php index 64d7146d..ac5d67be 100644 --- a/src/Dibi/Helpers.php +++ b/src/Dibi/Helpers.php @@ -220,11 +220,11 @@ class Helpers * @param string alias key * @return void */ - public static function alias(& $config, $key, $alias) + public static function alias(&$config, $key, $alias) { - $foo = & $config; + $foo = &$config; foreach (explode('|', $key) as $key) { - $foo = & $foo[$key]; + $foo = &$foo[$key]; } if (!isset($foo) && isset($config[$alias])) { diff --git a/src/Dibi/Result.php b/src/Dibi/Result.php index fdc7ca3f..bd1cbd6b 100644 --- a/src/Dibi/Result.php +++ b/src/Dibi/Result.php @@ -291,12 +291,12 @@ class Result implements IDataSource // make associative tree do { - $x = & $data; + $x = &$data; // iterative deepening foreach ($assoc as $i => $as) { if ($as === '[]') { // indexed-array node - $x = & $x[]; + $x = &$x[]; } elseif ($as === '=') { // "value" node $x = $row->{$assoc[$i + 1]}; @@ -305,14 +305,14 @@ class Result implements IDataSource } elseif ($as === '->') { // "object" node if ($x === NULL) { $x = clone $row; - $x = & $x->{$assoc[$i + 1]}; + $x = &$x->{$assoc[$i + 1]}; $x = NULL; // prepare child node } else { - $x = & $x->{$assoc[$i + 1]}; + $x = &$x->{$assoc[$i + 1]}; } } elseif ($as !== '|') { // associative-array node - $x = & $x[$row->$as]; + $x = &$x[$row->$as]; } } @@ -356,32 +356,32 @@ class Result implements IDataSource } do { - $x = & $data; + $x = &$data; foreach ($assoc as $i => $as) { if ($as === '#') { // indexed-array node - $x = & $x[]; + $x = &$x[]; } elseif ($as === '=') { // "record" node if ($x === NULL) { $x = $row->toArray(); - $x = & $x[ $assoc[$i + 1] ]; + $x = &$x[ $assoc[$i + 1] ]; $x = NULL; // prepare child node } else { - $x = & $x[ $assoc[$i + 1] ]; + $x = &$x[ $assoc[$i + 1] ]; } } elseif ($as === '@') { // "object" node if ($x === NULL) { $x = clone $row; - $x = & $x->{$assoc[$i + 1]}; + $x = &$x->{$assoc[$i + 1]}; $x = NULL; // prepare child node } else { - $x = & $x->{$assoc[$i + 1]}; + $x = &$x->{$assoc[$i + 1]}; } } else { // associative-array node - $x = & $x[$row->$as]; + $x = &$x[$row->$as]; } } @@ -483,7 +483,7 @@ class Result implements IDataSource * @param array * @return void */ - private function normalize(array & $row) + private function normalize(array &$row) { foreach ($this->types as $key => $type) { if (!isset($row[$key])) { // NULL diff --git a/src/Dibi/Strict.php b/src/Dibi/Strict.php index a93e32c9..6b5e9a91 100644 --- a/src/Dibi/Strict.php +++ b/src/Dibi/Strict.php @@ -131,7 +131,7 @@ trait Strict $list = & self::$extMethods[strtolower($name)]; if ($callback === NULL) { // getter - $cache = & $list[''][$class]; + $cache = &$list[''][$class]; if (isset($cache)) { return $cache; } diff --git a/src/Dibi/Translator.php b/src/Dibi/Translator.php index 3ea61163..13cf13ed 100644 --- a/src/Dibi/Translator.php +++ b/src/Dibi/Translator.php @@ -73,8 +73,8 @@ final class Translator $commandIns = NULL; $lastArr = NULL; - $cursor = & $this->cursor; - $comment = & $this->comment; + $cursor = &$this->cursor; + $comment = &$this->comment; // iterate $sql = []; @@ -480,7 +480,7 @@ final class Translator if (!empty($matches[11])) { // placeholder - $cursor = & $this->cursor; + $cursor = &$this->cursor; if ($cursor >= count($this->args)) { return $this->errors[] = '**Extra placeholder**'; @@ -492,7 +492,7 @@ final class Translator if (!empty($matches[10])) { // modifier $mod = $matches[10]; - $cursor = & $this->cursor; + $cursor = &$this->cursor; if ($cursor >= count($this->args) && $mod !== 'else' && $mod !== 'end') { return $this->errors[] = "**Extra modifier %$mod**"; @@ -600,7 +600,7 @@ final class Translator { $value = $this->connection->substitute($value); $parts = explode('.', $value); - foreach ($parts as & $v) { + foreach ($parts as &$v) { if ($v !== '*') { $v = $this->driver->escapeIdentifier($v); } diff --git a/src/Dibi/interfaces.php b/src/Dibi/interfaces.php index 7ae2570d..a3b5dd74 100644 --- a/src/Dibi/interfaces.php +++ b/src/Dibi/interfaces.php @@ -30,7 +30,7 @@ interface Driver * @return void * @throws Exception */ - function connect(array & $config); + function connect(array &$config); /** * Disconnects from a database. @@ -124,7 +124,7 @@ interface Driver * Injects LIMIT/OFFSET to the SQL query. * @return void */ - function applyLimit(& $sql, $limit, $offset); + function applyLimit(&$sql, $limit, $offset); } diff --git a/tests/dibi/Fluent.fetch.limit.mssql.phpt b/tests/dibi/Fluent.fetch.limit.mssql.phpt index 20314ee7..0adfff44 100644 --- a/tests/dibi/Fluent.fetch.limit.mssql.phpt +++ b/tests/dibi/Fluent.fetch.limit.mssql.phpt @@ -10,7 +10,7 @@ class MockDriver extends Dibi\Drivers\SqlsrvDriver function __construct() {} - function connect(array & $config) + function connect(array &$config) {} function query($sql) diff --git a/tests/dibi/Result.normalize.phpt b/tests/dibi/Result.normalize.phpt index b7521cc1..cdcc51b3 100644 --- a/tests/dibi/Result.normalize.phpt +++ b/tests/dibi/Result.normalize.phpt @@ -15,7 +15,7 @@ class MockResult extends Dibi\Result { $normalize = new ReflectionMethod('Dibi\Result', 'normalize'); $normalize->setAccessible(TRUE); - $normalize->invokeArgs($this, [& $row]); + $normalize->invokeArgs($this, [&$row]); return $row; } }