Anonymous function should have native return typehint

parent 8b0ddf60
......@@ -180,7 +180,7 @@ class DBALException extends Exception
*/
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)) {
return (string) $param;
}
......
......@@ -63,8 +63,10 @@ class MysqliConnection implements PingableConnection, ServerInfoAwareConnection
$this->setSecureConnection($params);
$this->setDriverOptions($driverOptions);
set_error_handler(static function () {
set_error_handler(static function () : bool {
return true;
});
try {
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);
......
......@@ -79,7 +79,7 @@ class Driver extends AbstractSQLAnywhereDriver
';PWD=' . $password .
';' . implode(
';',
array_map(static function ($key, $value) {
array_map(static function ($key, $value) : string {
return $key . '=' . $value;
}, array_keys($driverOptions), $driverOptions)
);
......
......@@ -905,7 +905,7 @@ SQL
return $this->doConvertBooleans(
$item,
static function ($boolean) {
static function ($boolean) : ?int {
return $boolean === null ? null : (int) $boolean;
}
);
......
......@@ -201,7 +201,7 @@ abstract class AbstractAsset
*/
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));
}, $columnNames));
......
......@@ -93,7 +93,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$names = $this->getSchemaNames();
$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);
});
}
......
......@@ -637,7 +637,7 @@ class Table extends AbstractAsset
*/
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);
}, ARRAY_FILTER_USE_KEY);
}
......
......@@ -283,7 +283,7 @@ class ConnectionTest extends FunctionalTestCase
public function testTransactionalReturnValue() : void
{
$res = $this->connection->transactional(static function () {
$res = $this->connection->transactional(static function () : int {
return 42;
});
......
......@@ -737,7 +737,7 @@ class DataAccessTest extends FunctionalTestCase
$stmt->setFetchMode(FetchMode::NUMERIC);
$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);
}), 'should be no non-numerical elements in the result.');
}
......
......@@ -303,7 +303,7 @@ EOF
false,
],
'fetch-all' => [
static function (Statement $stmt) {
static function (Statement $stmt) : array {
return $stmt->fetchAll();
},
[],
......
......@@ -169,7 +169,7 @@ class WriteTest extends FunctionalTestCase
}
$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';
}));
......
......@@ -72,7 +72,7 @@ abstract class FunctionalTestCase extends TestCase
$queries = '';
$i = count($this->sqlLoggerStack->queries);
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)) {
return get_class($p);
}
......
......@@ -92,7 +92,7 @@ final class DB2SchemaManagerTest extends TestCase
public function testListTableNamesFiltersAssetNamesCorrectlyWithCallable() : void
{
$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);
});
$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