Skip to content

Commit 904e4f2

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.6
2 parents c05260c + d49d700 commit 904e4f2

File tree

24 files changed

+54
-36
lines changed

24 files changed

+54
-36
lines changed

rector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector;
5454
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
5555
use Rector\TypeDeclaration\Rector\Closure\AddClosureVoidReturnTypeWhereNoReturnRector;
56+
use Rector\TypeDeclaration\Rector\Closure\ClosureReturnTypeRector;
5657
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
5758
use Rector\TypeDeclaration\Rector\Function_\AddFunctionVoidReturnTypeWhereNoReturnRector;
5859
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
@@ -217,6 +218,7 @@
217218
AddFunctionVoidReturnTypeWhereNoReturnRector::class,
218219
AddMethodCallBasedStrictParamTypeRector::class,
219220
TypedPropertyFromAssignsRector::class,
221+
ClosureReturnTypeRector::class,
220222
])
221223
->withConfiguredRule(StringClassNameToClassConstantRector::class, [
222224
// keep '\\' prefix string on string '\Foo\Bar'

system/Database/OCI8/Builder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ protected function _replace(string $table, array $keys, array $values): string
109109
{
110110
$fieldNames = array_map(static fn ($columnName) => trim($columnName, '"'), $keys);
111111

112-
$uniqueIndexes = array_filter($this->db->getIndexData($table), static function ($index) use ($fieldNames) {
112+
$uniqueIndexes = array_filter($this->db->getIndexData($table), static function ($index) use ($fieldNames): bool {
113113
$hasAllFields = count(array_intersect($index->fields, $fieldNames)) === count($index->fields);
114114

115115
return ($index->type === 'PRIMARY') && $hasAllFields;
116116
});
117-
$replaceableFields = array_filter($keys, static function ($columnName) use ($uniqueIndexes) {
117+
$replaceableFields = array_filter($keys, static function ($columnName) use ($uniqueIndexes): bool {
118118
foreach ($uniqueIndexes as $index) {
119119
if (in_array(trim($columnName, '"'), $index->fields, true)) {
120120
return false;
@@ -344,7 +344,7 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
344344
if (empty($constraints)) {
345345
$fieldNames = array_map(static fn ($columnName) => trim($columnName, '"'), $keys);
346346

347-
$uniqueIndexes = array_filter($this->db->getIndexData($table), static function ($index) use ($fieldNames) {
347+
$uniqueIndexes = array_filter($this->db->getIndexData($table), static function ($index) use ($fieldNames): bool {
348348
$hasAllFields = count(array_intersect($index->fields, $fieldNames)) === count($index->fields);
349349

350350
return ($index->type === 'PRIMARY' || $index->type === 'UNIQUE') && $hasAllFields;

system/Database/OCI8/PreparedQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function parameterize(string $sql): string
113113
// Track our current value
114114
$count = 0;
115115

116-
return preg_replace_callback('/\?/', static function ($matches) use (&$count) {
116+
return preg_replace_callback('/\?/', static function ($matches) use (&$count): string {
117117
return ':' . ($count++);
118118
}, $sql);
119119
}

system/Database/Postgre/Builder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ protected function _updateBatch(string $table, array $keys, array $values): stri
368368
$sql .= 'WHERE ' . implode(
369369
' AND ',
370370
array_map(
371-
static function ($key, $value) use ($table, $alias, $that) {
371+
static function ($key, $value) use ($table, $alias, $that): string|RawSql {
372372
if ($value instanceof RawSql && is_string($key)) {
373373
return $table . '.' . $key . ' = ' . $value;
374374
}
@@ -463,7 +463,7 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
463463
$constraints = $this->QBOptions['constraints'] ?? [];
464464

465465
if (empty($constraints)) {
466-
$allIndexes = array_filter($this->db->getIndexData($table), static function ($index) use ($fieldNames) {
466+
$allIndexes = array_filter($this->db->getIndexData($table), static function ($index) use ($fieldNames): bool {
467467
$hasAllFields = count(array_intersect($index->fields, $fieldNames)) === count($index->fields);
468468

469469
return ($index->type === 'UNIQUE' || $index->type === 'PRIMARY') && $hasAllFields;
@@ -575,7 +575,7 @@ protected function _deleteBatch(string $table, array $keys, array $values): stri
575575
$sql .= 'WHERE ' . implode(
576576
' AND ',
577577
array_map(
578-
static function ($key, $value) use ($table, $alias, $that) {
578+
static function ($key, $value) use ($table, $alias, $that): RawSql|string {
579579
if ($value instanceof RawSql) {
580580
return $value;
581581
}

system/Database/Postgre/PreparedQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function parameterize(string $sql): string
119119
// Track our current value
120120
$count = 0;
121121

122-
return preg_replace_callback('/\?/', static function () use (&$count) {
122+
return preg_replace_callback('/\?/', static function () use (&$count): string {
123123
$count++;
124124

125125
return "\${$count}";

system/Database/SQLSRV/Builder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,15 +699,15 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
699699
if (empty($constraints)) {
700700
$tableIndexes = $this->db->getIndexData($table);
701701

702-
$uniqueIndexes = array_filter($tableIndexes, static function ($index) use ($fieldNames) {
702+
$uniqueIndexes = array_filter($tableIndexes, static function ($index) use ($fieldNames): bool {
703703
$hasAllFields = count(array_intersect($index->fields, $fieldNames)) === count($index->fields);
704704

705705
return $index->type === 'PRIMARY' && $hasAllFields;
706706
});
707707

708708
// if no primary found then look for unique - since indexes have no order
709709
if ($uniqueIndexes === []) {
710-
$uniqueIndexes = array_filter($tableIndexes, static function ($index) use ($fieldNames) {
710+
$uniqueIndexes = array_filter($tableIndexes, static function ($index) use ($fieldNames): bool {
711711
$hasAllFields = count(array_intersect($index->fields, $fieldNames)) === count($index->fields);
712712

713713
return $index->type === 'UNIQUE' && $hasAllFields;

system/Database/SQLite3/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
145145
if (empty($constraints)) {
146146
$fieldNames = array_map(static fn ($columnName) => trim($columnName, '`'), $keys);
147147

148-
$allIndexes = array_filter($this->db->getIndexData($table), static function ($index) use ($fieldNames) {
148+
$allIndexes = array_filter($this->db->getIndexData($table), static function ($index) use ($fieldNames): bool {
149149
$hasAllFields = count(array_intersect($index->fields, $fieldNames)) === count($index->fields);
150150

151151
return ($index->type === 'PRIMARY' || $index->type === 'UNIQUE') && $hasAllFields;

system/Debug/Toolbar/Collectors/Database.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ protected function formatTimelineData(): array
148148
public function display(): array
149149
{
150150
$data = [];
151-
$data['queries'] = array_map(static function (array $query) {
151+
$data['queries'] = array_map(static function (array $query): array {
152152
$isDuplicate = $query['duplicate'] === true;
153153

154154
$firstNonSystemLine = '';

system/Events/Events.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static function initialize()
8484
$files = service('locator')->search('Config/Events.php');
8585
}
8686

87-
$files = array_filter(array_map(static function (string $file) {
87+
$files = array_filter(array_map(static function (string $file): false|string {
8888
if (is_file($file)) {
8989
return realpath($file) ?: $file;
9090
}

system/HTTP/ContentSecurityPolicy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ protected function generateNonces(ResponseInterface $response)
713713
$pattern = '/(' . preg_quote($this->styleNonceTag, '/')
714714
. '|' . preg_quote($this->scriptNonceTag, '/') . ')/';
715715

716-
$body = preg_replace_callback($pattern, function ($match) {
716+
$body = preg_replace_callback($pattern, function ($match): string {
717717
$nonce = $match[0] === $this->styleNonceTag ? $this->getStyleNonce() : $this->getScriptNonce();
718718

719719
return "nonce=\"{$nonce}\"";

0 commit comments

Comments
 (0)