Skip to content

Commit 23ff42d

Browse files
committed
typos, PHP 5.5 syntax
1 parent 285b7a2 commit 23ff42d

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

src/Database/IConventions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface IConventions
1616
/**
1717
* Returns primary key for table.
1818
* @param string
19-
* @return string
19+
* @return string|array|NULL
2020
*/
2121
function getPrimary($table);
2222

src/Database/Table/Selection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Selection extends Nette\Object implements \Iterator, IRowContainer, \Array
3333
/** @var string table name */
3434
protected $name;
3535

36-
/** @var string primary key field name */
36+
/** @var string|array|NULL primary key field name */
3737
protected $primary;
3838

3939
/** @var string|bool primary column sequence name, FALSE for autodetection */
@@ -122,7 +122,7 @@ public function getName()
122122

123123
/**
124124
* @param bool
125-
* @return string|array
125+
* @return string|array|NULL
126126
*/
127127
public function getPrimary($need = TRUE)
128128
{

src/Database/Table/SqlBuilder.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public function __construct($tableName, Context $context)
8080
$this->driver = $context->getConnection()->getSupplementalDriver();
8181
$this->conventions = $context->getConventions();
8282
$this->structure = $context->getStructure();
83-
8483
$this->delimitedTable = implode('.', array_map([$this->driver, 'delimite'], explode('.', $tableName)));
8584
}
8685

@@ -151,7 +150,6 @@ public function buildSelectQuery($columns = NULL)
151150
} else {
152151
$prefix = $joins ? "{$this->delimitedTable}." : '';
153152
$querySelect = $this->buildSelect([$prefix . '*']);
154-
155153
}
156154

157155
$queryJoins = $this->buildQueryJoins($joins);
@@ -405,16 +403,15 @@ protected function buildSelect(array $columns)
405403

406404
protected function parseJoins(& $joins, & $query)
407405
{
408-
$builder = $this;
409406
$query = preg_replace_callback('~
410407
(?(DEFINE)
411408
(?P<word> [\w_]*[a-z][\w_]* )
412409
(?P<del> [.:] )
413410
(?P<node> (?&del)? (?&word) (\((?&word)\))? )
414411
)
415412
(?P<chain> (?!\.) (?&node)*) \. (?P<column> (?&word) | \* )
416-
~xi', function ($match) use (& $joins, $builder) {
417-
return $builder->parseJoinsCb($joins, $match);
413+
~xi', function ($match) use (& $joins) {
414+
return $this->parseJoinsCb($joins, $match);
418415
}, $query);
419416
}
420417

@@ -503,14 +500,11 @@ public function parseJoinsCb(& $joins, $match)
503500
protected function buildQueryJoins(array $joins)
504501
{
505502
$return = '';
506-
foreach ($joins as $join) {
507-
list($joinTable, $joinAlias, $table, $tableColumn, $joinColumn) = $join;
508-
503+
foreach ($joins as list($joinTable, $joinAlias, $table, $tableColumn, $joinColumn)) {
509504
$return .=
510505
" LEFT JOIN {$joinTable}" . ($joinTable !== $joinAlias ? " {$joinAlias}" : '') .
511506
" ON {$table}.{$tableColumn} = {$joinAlias}.{$joinColumn}";
512507
}
513-
514508
return $return;
515509
}
516510

@@ -539,9 +533,8 @@ protected function buildQueryEnd()
539533

540534
protected function tryDelimite($s)
541535
{
542-
$driver = $this->driver;
543-
return preg_replace_callback('#(?<=[^\w`"\[?]|^)[a-z_][a-z0-9_]*(?=[^\w`"(\]]|\z)#i', function ($m) use ($driver) {
544-
return strtoupper($m[0]) === $m[0] ? $m[0] : $driver->delimite($m[0]);
536+
return preg_replace_callback('#(?<=[^\w`"\[?]|^)[a-z_][a-z0-9_]*(?=[^\w`"(\]]|\z)#i', function ($m) {
537+
return strtoupper($m[0]) === $m[0] ? $m[0] : $this->driver->delimite($m[0]);
545538
}, $s);
546539
}
547540

0 commit comments

Comments
 (0)