Anonymous function should have native return typehint

parent 8b0ddf60
...@@ -180,7 +180,7 @@ class DBALException extends Exception ...@@ -180,7 +180,7 @@ class DBALException extends Exception
*/ */
private static function formatParameters(array $params) private static function formatParameters(array $params)
{ {
return '[' . implode(', ', array_map(static function ($param) { return '[' . implode(', ', array_map(static function ($param) : string {
if (is_resource($param)) { if (is_resource($param)) {
return (string) $param; return (string) $param;
} }
......
...@@ -63,8 +63,10 @@ class MysqliConnection implements PingableConnection, ServerInfoAwareConnection ...@@ -63,8 +63,10 @@ class MysqliConnection implements PingableConnection, ServerInfoAwareConnection
$this->setSecureConnection($params); $this->setSecureConnection($params);
$this->setDriverOptions($driverOptions); $this->setDriverOptions($driverOptions);
set_error_handler(static function () { set_error_handler(static function () : bool {
return true;
}); });
try { try {
if (! $this->conn->real_connect($host, $username, $password, $dbname, $port, $socket, $flags)) { if (! $this->conn->real_connect($host, $username, $password, $dbname, $port, $socket, $flags)) {
throw new MysqliException($this->conn->connect_error, $this->conn->sqlstate ?? 'HY000', $this->conn->connect_errno); throw new MysqliException($this->conn->connect_error, $this->conn->sqlstate ?? 'HY000', $this->conn->connect_errno);
......
...@@ -79,7 +79,7 @@ class Driver extends AbstractSQLAnywhereDriver ...@@ -79,7 +79,7 @@ class Driver extends AbstractSQLAnywhereDriver
';PWD=' . $password . ';PWD=' . $password .
';' . implode( ';' . implode(
';', ';',
array_map(static function ($key, $value) { array_map(static function ($key, $value) : string {
return $key . '=' . $value; return $key . '=' . $value;
}, array_keys($driverOptions), $driverOptions) }, array_keys($driverOptions), $driverOptions)
); );
......
...@@ -905,7 +905,7 @@ SQL ...@@ -905,7 +905,7 @@ SQL
return $this->doConvertBooleans( return $this->doConvertBooleans(
$item, $item,
static function ($boolean) { static function ($boolean) : ?int {
return $boolean === null ? null : (int) $boolean; return $boolean === null ? null : (int) $boolean;
} }
); );
......
...@@ -201,7 +201,7 @@ abstract class AbstractAsset ...@@ -201,7 +201,7 @@ abstract class AbstractAsset
*/ */
protected function _generateIdentifierName($columnNames, $prefix = '', $maxSize = 30) protected function _generateIdentifierName($columnNames, $prefix = '', $maxSize = 30)
{ {
$hash = implode('', array_map(static function ($column) { $hash = implode('', array_map(static function ($column) : string {
return dechex(crc32($column)); return dechex(crc32($column));
}, $columnNames)); }, $columnNames));
......
...@@ -93,7 +93,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager ...@@ -93,7 +93,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$names = $this->getSchemaNames(); $names = $this->getSchemaNames();
$paths = $this->getSchemaSearchPaths(); $paths = $this->getSchemaSearchPaths();
$this->existingSchemaPaths = array_filter($paths, static function ($v) use ($names) { $this->existingSchemaPaths = array_filter($paths, static function ($v) use ($names) : bool {
return in_array($v, $names, true); return in_array($v, $names, true);
}); });
} }
......
...@@ -637,7 +637,7 @@ class Table extends AbstractAsset ...@@ -637,7 +637,7 @@ class Table extends AbstractAsset
*/ */
private function filterColumns(array $columnNames) private function filterColumns(array $columnNames)
{ {
return array_filter($this->_columns, static function ($columnName) use ($columnNames) { return array_filter($this->_columns, static function ($columnName) use ($columnNames) : bool {
return in_array($columnName, $columnNames, true); return in_array($columnName, $columnNames, true);
}, ARRAY_FILTER_USE_KEY); }, ARRAY_FILTER_USE_KEY);
} }
......
...@@ -283,7 +283,7 @@ class ConnectionTest extends FunctionalTestCase ...@@ -283,7 +283,7 @@ class ConnectionTest extends FunctionalTestCase
public function testTransactionalReturnValue() : void public function testTransactionalReturnValue() : void
{ {
$res = $this->connection->transactional(static function () { $res = $this->connection->transactional(static function () : int {
return 42; return 42;
}); });
......
...@@ -737,7 +737,7 @@ class DataAccessTest extends FunctionalTestCase ...@@ -737,7 +737,7 @@ class DataAccessTest extends FunctionalTestCase
$stmt->setFetchMode(FetchMode::NUMERIC); $stmt->setFetchMode(FetchMode::NUMERIC);
$row = array_keys($stmt->fetch()); $row = array_keys($stmt->fetch());
self::assertCount(0, array_filter($row, static function ($v) { self::assertCount(0, array_filter($row, static function ($v) : bool {
return ! is_numeric($v); return ! is_numeric($v);
}), 'should be no non-numerical elements in the result.'); }), 'should be no non-numerical elements in the result.');
} }
......
...@@ -303,7 +303,7 @@ EOF ...@@ -303,7 +303,7 @@ EOF
false, false,
], ],
'fetch-all' => [ 'fetch-all' => [
static function (Statement $stmt) { static function (Statement $stmt) : array {
return $stmt->fetchAll(); return $stmt->fetchAll();
}, },
[], [],
......
...@@ -169,7 +169,7 @@ class WriteTest extends FunctionalTestCase ...@@ -169,7 +169,7 @@ class WriteTest extends FunctionalTestCase
} }
$sequences = $this->connection->getSchemaManager()->listSequences(); $sequences = $this->connection->getSchemaManager()->listSequences();
self::assertCount(1, array_filter($sequences, static function ($sequence) { self::assertCount(1, array_filter($sequences, static function ($sequence) : bool {
return strtolower($sequence->getName()) === 'write_table_id_seq'; return strtolower($sequence->getName()) === 'write_table_id_seq';
})); }));
......
...@@ -72,7 +72,7 @@ abstract class FunctionalTestCase extends TestCase ...@@ -72,7 +72,7 @@ abstract class FunctionalTestCase extends TestCase
$queries = ''; $queries = '';
$i = count($this->sqlLoggerStack->queries); $i = count($this->sqlLoggerStack->queries);
foreach (array_reverse($this->sqlLoggerStack->queries) as $query) { foreach (array_reverse($this->sqlLoggerStack->queries) as $query) {
$params = array_map(static function ($p) { $params = array_map(static function ($p) : string {
if (is_object($p)) { if (is_object($p)) {
return get_class($p); return get_class($p);
} }
......
...@@ -92,7 +92,7 @@ final class DB2SchemaManagerTest extends TestCase ...@@ -92,7 +92,7 @@ final class DB2SchemaManagerTest extends TestCase
public function testListTableNamesFiltersAssetNamesCorrectlyWithCallable() : void public function testListTableNamesFiltersAssetNamesCorrectlyWithCallable() : void
{ {
$accepted = ['T_FOO', 'T_BAR']; $accepted = ['T_FOO', 'T_BAR'];
$this->conn->getConfiguration()->setSchemaAssetsFilter(static function ($assetName) use ($accepted) { $this->conn->getConfiguration()->setSchemaAssetsFilter(static function ($assetName) use ($accepted) : bool {
return in_array($assetName, $accepted, true); return in_array($assetName, $accepted, true);
}); });
$this->conn->expects(self::any())->method('quote'); $this->conn->expects(self::any())->method('quote');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment