Skip to content

Commit

Permalink
added missing typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Oct 16, 2018
1 parent a559a76 commit b7b1b99
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Database/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ class Connection
{
use Nette\SmartObject;

/** @var callable[] function (Connection $connection); Occurs after connection is established */
/** @var callable[] function (Connection $connection): void; Occurs after connection is established */
public $onConnect;

/** @var callable[] function (Connection $connection, ResultSet|DriverException $result); Occurs after query is executed */
/** @var callable[] function (Connection $connection, ResultSet|DriverException $result): void; Occurs after query is executed */
public $onQuery;

/** @var array */
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static function dumpSql($sql, array $params = null, Connection $connectio

// syntax highlight
$sql = htmlspecialchars($sql, ENT_IGNORE, 'UTF-8');
$sql = preg_replace_callback("#(/\\*.+?\\*/)|(\\*\\*.+?\\*\\*)|(?<=[\\s,(])($keywords1)(?=[\\s,)])|(?<=[\\s,(=])($keywords2)(?=[\\s,)=])#is", function ($matches) {
$sql = preg_replace_callback("#(/\\*.+?\\*/)|(\\*\\*.+?\\*\\*)|(?<=[\\s,(])($keywords1)(?=[\\s,)])|(?<=[\\s,(=])($keywords2)(?=[\\s,)=])#is", function (array $matches) {
if (!empty($matches[1])) { // comment
return '<em style="color:gray">' . $matches[1] . '</em>';

Expand Down
6 changes: 3 additions & 3 deletions src/Database/Table/SqlBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ protected function parseJoinConditions(&$joins, $joinConditions)
$tableAlias = substr($fooQuery, 0, -4);
$tableJoins[$tableAlias] = $requiredJoins;
$leftJoinDependency[$tableAlias] = [];
$finalJoinConditions[$tableAlias] = preg_replace_callback($this->getColumnChainsRegxp(), function ($match) use ($tableAlias, &$tableJoins, &$leftJoinDependency) {
$finalJoinConditions[$tableAlias] = preg_replace_callback($this->getColumnChainsRegxp(), function (array $match) use ($tableAlias, &$tableJoins, &$leftJoinDependency) {
$requiredJoins = [];
$query = $this->parseJoinsCb($requiredJoins, $match);
$queryParts = explode('.', $query);
Expand Down Expand Up @@ -655,7 +655,7 @@ protected function getSortedJoins($table, &$leftJoinDependency, &$tableJoins, &$

protected function parseJoins(&$joins, &$query)
{
$query = preg_replace_callback($this->getColumnChainsRegxp(), function ($match) use (&$joins) {
$query = preg_replace_callback($this->getColumnChainsRegxp(), function (array $match) use (&$joins) {
return $this->parseJoinsCb($joins, $match);
}, $query);
}
Expand Down Expand Up @@ -895,7 +895,7 @@ private function getConditionHash($condition, array $parameters)
private function getCachedTableList()
{
if (!$this->cacheTableList) {
$this->cacheTableList = array_flip(array_map(function ($pair) {
$this->cacheTableList = array_flip(array_map(function (array $pair) {
return isset($pair['fullName']) ? $pair['fullName'] : $pair['name'];
}, $this->structure->getTables()));
}
Expand Down

0 comments on commit b7b1b99

Please sign in to comment.