1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-04 21:28:02 +02:00

coding style: removed space after reference &

This commit is contained in:
David Grudl
2017-06-09 21:55:33 +02:00
parent f7009f3e0c
commit d9628f933d
19 changed files with 60 additions and 60 deletions

View File

@@ -97,7 +97,7 @@ class Connection
$this->config = $config; $this->config = $config;
// profiler // profiler
$profilerCfg = & $config['profiler']; $profilerCfg = &$config['profiler'];
if (is_scalar($profilerCfg)) { if (is_scalar($profilerCfg)) {
$profilerCfg = ['run' => (bool) $profilerCfg]; $profilerCfg = ['run' => (bool) $profilerCfg];
} }
@@ -204,7 +204,7 @@ class Connection
/** @deprecated */ /** @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); trigger_error(__METHOD__ . '() is deprecated, use Helpers::alias().', E_USER_DEPRECATED);
Helpers::alias($config, $key, $alias); Helpers::alias($config, $key, $alias);

View File

@@ -60,7 +60,7 @@ class FirebirdDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
* @return void * @return void
* @throws Dibi\Exception * @throws Dibi\Exception
*/ */
public function connect(array & $config) public function connect(array &$config)
{ {
Dibi\Helpers::alias($config, 'database', 'db'); 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. * Injects LIMIT/OFFSET to the SQL query.
* @return void * @return void
*/ */
public function applyLimit(& $sql, $limit, $offset) public function applyLimit(&$sql, $limit, $offset)
{ {
if ($limit > 0 || $offset > 0) { if ($limit > 0 || $offset > 0) {
// http://www.firebirdsql.org/refdocs/langrefupd20-select.html // http://www.firebirdsql.org/refdocs/langrefupd20-select.html

View File

@@ -52,7 +52,7 @@ class MsSqlDriver implements Dibi\Driver, Dibi\ResultDriver
* @return void * @return void
* @throws Dibi\Exception * @throws Dibi\Exception
*/ */
public function connect(array & $config) public function connect(array &$config)
{ {
if (isset($config['resource'])) { if (isset($config['resource'])) {
$this->connection = $config['resource']; $this->connection = $config['resource'];
@@ -282,7 +282,7 @@ class MsSqlDriver implements Dibi\Driver, Dibi\ResultDriver
* Injects LIMIT/OFFSET to the SQL query. * Injects LIMIT/OFFSET to the SQL query.
* @return void * @return void
*/ */
public function applyLimit(& $sql, $limit, $offset) public function applyLimit(&$sql, $limit, $offset)
{ {
if ($offset) { if ($offset) {
throw new Dibi\NotSupportedException('Offset is not supported by this database.'); throw new Dibi\NotSupportedException('Offset is not supported by this database.');

View File

@@ -65,7 +65,7 @@ class MySqlDriver implements Dibi\Driver, Dibi\ResultDriver
* @return void * @return void
* @throws Dibi\Exception * @throws Dibi\Exception
*/ */
public function connect(array & $config) public function connect(array &$config)
{ {
if (isset($config['resource'])) { if (isset($config['resource'])) {
$this->connection = $config['resource']; $this->connection = $config['resource'];
@@ -367,7 +367,7 @@ class MySqlDriver implements Dibi\Driver, Dibi\ResultDriver
* Injects LIMIT/OFFSET to the SQL query. * Injects LIMIT/OFFSET to the SQL query.
* @return void * @return void
*/ */
public function applyLimit(& $sql, $limit, $offset) public function applyLimit(&$sql, $limit, $offset)
{ {
if ($limit < 0 || $offset < 0) { if ($limit < 0 || $offset < 0) {
throw new Dibi\NotSupportedException('Negative offset or limit.'); throw new Dibi\NotSupportedException('Negative offset or limit.');

View File

@@ -66,7 +66,7 @@ class MySqliDriver implements Dibi\Driver, Dibi\ResultDriver
* @return void * @return void
* @throws Dibi\Exception * @throws Dibi\Exception
*/ */
public function connect(array & $config) public function connect(array &$config)
{ {
mysqli_report(MYSQLI_REPORT_OFF); mysqli_report(MYSQLI_REPORT_OFF);
if (isset($config['resource'])) { if (isset($config['resource'])) {
@@ -93,8 +93,8 @@ class MySqliDriver implements Dibi\Driver, Dibi\ResultDriver
} }
} }
$foo = & $config['flags']; $foo = &$config['flags'];
$foo = & $config['database']; $foo = &$config['database'];
$this->connection = mysqli_init(); $this->connection = mysqli_init();
if (isset($config['options'])) { if (isset($config['options'])) {
@@ -375,7 +375,7 @@ class MySqliDriver implements Dibi\Driver, Dibi\ResultDriver
* Injects LIMIT/OFFSET to the SQL query. * Injects LIMIT/OFFSET to the SQL query.
* @return void * @return void
*/ */
public function applyLimit(& $sql, $limit, $offset) public function applyLimit(&$sql, $limit, $offset)
{ {
if ($limit < 0 || $offset < 0) { if ($limit < 0 || $offset < 0) {
throw new Dibi\NotSupportedException('Negative offset or limit.'); throw new Dibi\NotSupportedException('Negative offset or limit.');

View File

@@ -57,7 +57,7 @@ class OdbcDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
* @return void * @return void
* @throws Dibi\Exception * @throws Dibi\Exception
*/ */
public function connect(array & $config) public function connect(array &$config)
{ {
if (isset($config['resource'])) { if (isset($config['resource'])) {
$this->connection = $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. * Injects LIMIT/OFFSET to the SQL query.
* @return void * @return void
*/ */
public function applyLimit(& $sql, $limit, $offset) public function applyLimit(&$sql, $limit, $offset)
{ {
if ($offset) { if ($offset) {
throw new Dibi\NotSupportedException('Offset is not supported by this database.'); throw new Dibi\NotSupportedException('Offset is not supported by this database.');

View File

@@ -64,9 +64,9 @@ class OracleDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
* @return void * @return void
* @throws Dibi\Exception * @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->fmtDate = isset($config['formatDate']) ? $config['formatDate'] : 'U';
$this->fmtDateTime = isset($config['formatDateTime']) ? $config['formatDateTime'] : '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. * Injects LIMIT/OFFSET to the SQL query.
* @return void * @return void
*/ */
public function applyLimit(& $sql, $limit, $offset) public function applyLimit(&$sql, $limit, $offset)
{ {
if ($limit < 0 || $offset < 0) { if ($limit < 0 || $offset < 0) {
throw new Dibi\NotSupportedException('Negative offset or limit.'); throw new Dibi\NotSupportedException('Negative offset or limit.');

View File

@@ -59,10 +59,10 @@ class PdoDriver implements Dibi\Driver, Dibi\ResultDriver
* @return void * @return void
* @throws Dibi\Exception * @throws Dibi\Exception
*/ */
public function connect(array & $config) public function connect(array &$config)
{ {
$foo = & $config['dsn']; $foo = &$config['dsn'];
$foo = & $config['options']; $foo = &$config['options'];
Dibi\Helpers::alias($config, 'resource', 'pdo'); Dibi\Helpers::alias($config, 'resource', 'pdo');
if ($config['resource'] instanceof PDO) { if ($config['resource'] instanceof PDO) {
@@ -396,7 +396,7 @@ class PdoDriver implements Dibi\Driver, Dibi\ResultDriver
* Injects LIMIT/OFFSET to the SQL query. * Injects LIMIT/OFFSET to the SQL query.
* @return void * @return void
*/ */
public function applyLimit(& $sql, $limit, $offset) public function applyLimit(&$sql, $limit, $offset)
{ {
if ($limit < 0 || $offset < 0) { if ($limit < 0 || $offset < 0) {
throw new Dibi\NotSupportedException('Negative offset or limit.'); throw new Dibi\NotSupportedException('Negative offset or limit.');

View File

@@ -55,7 +55,7 @@ class PostgreDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
* @return void * @return void
* @throws Dibi\Exception * @throws Dibi\Exception
*/ */
public function connect(array & $config) public function connect(array &$config)
{ {
$error = NULL; $error = NULL;
if (isset($config['resource'])) { 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; $error = $message;
}); });
if (empty($config['persistent'])) { if (empty($config['persistent'])) {
@@ -382,7 +382,7 @@ class PostgreDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
* Injects LIMIT/OFFSET to the SQL query. * Injects LIMIT/OFFSET to the SQL query.
* @return void * @return void
*/ */
public function applyLimit(& $sql, $limit, $offset) public function applyLimit(&$sql, $limit, $offset)
{ {
if ($limit < 0 || $offset < 0) { if ($limit < 0 || $offset < 0) {
throw new Dibi\NotSupportedException('Negative offset or limit.'); throw new Dibi\NotSupportedException('Negative offset or limit.');

View File

@@ -59,7 +59,7 @@ class Sqlite3Driver implements Dibi\Driver, Dibi\ResultDriver
* @return void * @return void
* @throws Dibi\Exception * @throws Dibi\Exception
*/ */
public function connect(array & $config) public function connect(array &$config)
{ {
Dibi\Helpers::alias($config, 'database', 'file'); Dibi\Helpers::alias($config, 'database', 'file');
$this->fmtDate = isset($config['formatDate']) ? $config['formatDate'] : 'U'; $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. * Injects LIMIT/OFFSET to the SQL query.
* @return void * @return void
*/ */
public function applyLimit(& $sql, $limit, $offset) public function applyLimit(&$sql, $limit, $offset)
{ {
if ($limit < 0 || $offset < 0) { if ($limit < 0 || $offset < 0) {
throw new Dibi\NotSupportedException('Negative offset or limit.'); throw new Dibi\NotSupportedException('Negative offset or limit.');

View File

@@ -61,7 +61,7 @@ class SqlsrvDriver implements Dibi\Driver, Dibi\ResultDriver
* @return void * @return void
* @throws Dibi\Exception * @throws Dibi\Exception
*/ */
public function connect(array & $config) public function connect(array &$config)
{ {
Helpers::alias($config, 'options|UID', 'username'); Helpers::alias($config, 'options|UID', 'username');
Helpers::alias($config, 'options|PWD', 'password'); Helpers::alias($config, 'options|PWD', 'password');
@@ -306,7 +306,7 @@ class SqlsrvDriver implements Dibi\Driver, Dibi\ResultDriver
* Injects LIMIT/OFFSET to the SQL query. * Injects LIMIT/OFFSET to the SQL query.
* @return void * @return void
*/ */
public function applyLimit(& $sql, $limit, $offset) public function applyLimit(&$sql, $limit, $offset)
{ {
if ($limit < 0 || $offset < 0) { if ($limit < 0 || $offset < 0) {
throw new Dibi\NotSupportedException('Negative offset or limit.'); throw new Dibi\NotSupportedException('Negative offset or limit.');

View File

@@ -130,19 +130,19 @@ class Fluent implements IDataSource
if (isset(self::$masks[$clause])) { if (isset(self::$masks[$clause])) {
$this->clauses = array_fill_keys(self::$masks[$clause], NULL); $this->clauses = array_fill_keys(self::$masks[$clause], NULL);
} }
$this->cursor = & $this->clauses[$clause]; $this->cursor = &$this->clauses[$clause];
$this->cursor = []; $this->cursor = [];
$this->command = $clause; $this->command = $clause;
} }
// auto-switch to a clause // auto-switch to a clause
if (isset(self::$clauseSwitches[$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)) { if (array_key_exists($clause, $this->clauses)) {
// append to clause // append to clause
$this->cursor = & $this->clauses[$clause]; $this->cursor = &$this->clauses[$clause];
// TODO: really delete? // TODO: really delete?
if ($args === [self::REMOVE]) { if ($args === [self::REMOVE]) {
@@ -211,7 +211,7 @@ class Fluent implements IDataSource
*/ */
public function clause($clause) public function clause($clause)
{ {
$this->cursor = & $this->clauses[self::$normalizer->$clause]; $this->cursor = &$this->clauses[self::$normalizer->$clause];
if ($this->cursor === NULL) { if ($this->cursor === NULL) {
$this->cursor = []; $this->cursor = [];
} }
@@ -512,10 +512,10 @@ class Fluent implements IDataSource
{ {
// remove references // remove references
foreach ($this->clauses as $clause => $val) { foreach ($this->clauses as $clause => $val) {
$this->clauses[$clause] = & $val; $this->clauses[$clause] = &$val;
unset($val); unset($val);
} }
$this->cursor = & $foo; $this->cursor = &$foo;
} }
} }

View File

@@ -220,11 +220,11 @@ class Helpers
* @param string alias key * @param string alias key
* @return void * @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) { foreach (explode('|', $key) as $key) {
$foo = & $foo[$key]; $foo = &$foo[$key];
} }
if (!isset($foo) && isset($config[$alias])) { if (!isset($foo) && isset($config[$alias])) {

View File

@@ -291,12 +291,12 @@ class Result implements IDataSource
// make associative tree // make associative tree
do { do {
$x = & $data; $x = &$data;
// iterative deepening // iterative deepening
foreach ($assoc as $i => $as) { foreach ($assoc as $i => $as) {
if ($as === '[]') { // indexed-array node if ($as === '[]') { // indexed-array node
$x = & $x[]; $x = &$x[];
} elseif ($as === '=') { // "value" node } elseif ($as === '=') { // "value" node
$x = $row->{$assoc[$i + 1]}; $x = $row->{$assoc[$i + 1]};
@@ -305,14 +305,14 @@ class Result implements IDataSource
} elseif ($as === '->') { // "object" node } elseif ($as === '->') { // "object" node
if ($x === NULL) { if ($x === NULL) {
$x = clone $row; $x = clone $row;
$x = & $x->{$assoc[$i + 1]}; $x = &$x->{$assoc[$i + 1]};
$x = NULL; // prepare child node $x = NULL; // prepare child node
} else { } else {
$x = & $x->{$assoc[$i + 1]}; $x = &$x->{$assoc[$i + 1]};
} }
} elseif ($as !== '|') { // associative-array node } elseif ($as !== '|') { // associative-array node
$x = & $x[$row->$as]; $x = &$x[$row->$as];
} }
} }
@@ -356,32 +356,32 @@ class Result implements IDataSource
} }
do { do {
$x = & $data; $x = &$data;
foreach ($assoc as $i => $as) { foreach ($assoc as $i => $as) {
if ($as === '#') { // indexed-array node if ($as === '#') { // indexed-array node
$x = & $x[]; $x = &$x[];
} elseif ($as === '=') { // "record" node } elseif ($as === '=') { // "record" node
if ($x === NULL) { if ($x === NULL) {
$x = $row->toArray(); $x = $row->toArray();
$x = & $x[ $assoc[$i + 1] ]; $x = &$x[ $assoc[$i + 1] ];
$x = NULL; // prepare child node $x = NULL; // prepare child node
} else { } else {
$x = & $x[ $assoc[$i + 1] ]; $x = &$x[ $assoc[$i + 1] ];
} }
} elseif ($as === '@') { // "object" node } elseif ($as === '@') { // "object" node
if ($x === NULL) { if ($x === NULL) {
$x = clone $row; $x = clone $row;
$x = & $x->{$assoc[$i + 1]}; $x = &$x->{$assoc[$i + 1]};
$x = NULL; // prepare child node $x = NULL; // prepare child node
} else { } else {
$x = & $x->{$assoc[$i + 1]}; $x = &$x->{$assoc[$i + 1]};
} }
} else { // associative-array node } else { // associative-array node
$x = & $x[$row->$as]; $x = &$x[$row->$as];
} }
} }
@@ -483,7 +483,7 @@ class Result implements IDataSource
* @param array * @param array
* @return void * @return void
*/ */
private function normalize(array & $row) private function normalize(array &$row)
{ {
foreach ($this->types as $key => $type) { foreach ($this->types as $key => $type) {
if (!isset($row[$key])) { // NULL if (!isset($row[$key])) { // NULL

View File

@@ -131,7 +131,7 @@ trait Strict
$list = & self::$extMethods[strtolower($name)]; $list = & self::$extMethods[strtolower($name)];
if ($callback === NULL) { // getter if ($callback === NULL) { // getter
$cache = & $list[''][$class]; $cache = &$list[''][$class];
if (isset($cache)) { if (isset($cache)) {
return $cache; return $cache;
} }

View File

@@ -73,8 +73,8 @@ final class Translator
$commandIns = NULL; $commandIns = NULL;
$lastArr = NULL; $lastArr = NULL;
$cursor = & $this->cursor; $cursor = &$this->cursor;
$comment = & $this->comment; $comment = &$this->comment;
// iterate // iterate
$sql = []; $sql = [];
@@ -480,7 +480,7 @@ final class Translator
if (!empty($matches[11])) { // placeholder if (!empty($matches[11])) { // placeholder
$cursor = & $this->cursor; $cursor = &$this->cursor;
if ($cursor >= count($this->args)) { if ($cursor >= count($this->args)) {
return $this->errors[] = '**Extra placeholder**'; return $this->errors[] = '**Extra placeholder**';
@@ -492,7 +492,7 @@ final class Translator
if (!empty($matches[10])) { // modifier if (!empty($matches[10])) { // modifier
$mod = $matches[10]; $mod = $matches[10];
$cursor = & $this->cursor; $cursor = &$this->cursor;
if ($cursor >= count($this->args) && $mod !== 'else' && $mod !== 'end') { if ($cursor >= count($this->args) && $mod !== 'else' && $mod !== 'end') {
return $this->errors[] = "**Extra modifier %$mod**"; return $this->errors[] = "**Extra modifier %$mod**";
@@ -600,7 +600,7 @@ final class Translator
{ {
$value = $this->connection->substitute($value); $value = $this->connection->substitute($value);
$parts = explode('.', $value); $parts = explode('.', $value);
foreach ($parts as & $v) { foreach ($parts as &$v) {
if ($v !== '*') { if ($v !== '*') {
$v = $this->driver->escapeIdentifier($v); $v = $this->driver->escapeIdentifier($v);
} }

View File

@@ -30,7 +30,7 @@ interface Driver
* @return void * @return void
* @throws Exception * @throws Exception
*/ */
function connect(array & $config); function connect(array &$config);
/** /**
* Disconnects from a database. * Disconnects from a database.
@@ -124,7 +124,7 @@ interface Driver
* Injects LIMIT/OFFSET to the SQL query. * Injects LIMIT/OFFSET to the SQL query.
* @return void * @return void
*/ */
function applyLimit(& $sql, $limit, $offset); function applyLimit(&$sql, $limit, $offset);
} }

View File

@@ -10,7 +10,7 @@ class MockDriver extends Dibi\Drivers\SqlsrvDriver
function __construct() function __construct()
{} {}
function connect(array & $config) function connect(array &$config)
{} {}
function query($sql) function query($sql)

View File

@@ -15,7 +15,7 @@ class MockResult extends Dibi\Result
{ {
$normalize = new ReflectionMethod('Dibi\Result', 'normalize'); $normalize = new ReflectionMethod('Dibi\Result', 'normalize');
$normalize->setAccessible(TRUE); $normalize->setAccessible(TRUE);
$normalize->invokeArgs($this, [& $row]); $normalize->invokeArgs($this, [&$row]);
return $row; return $row;
} }
} }