Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit e6d338c

Browse files
authored
Bump up codesniffer version and fix reported issues. (cakephp#18240)
1 parent 1094a03 commit e6d338c

35 files changed

+76
-76
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"cakephp/validation": "self.version"
5858
},
5959
"require-dev": {
60-
"cakephp/cakephp-codesniffer": "^5.0",
60+
"cakephp/cakephp-codesniffer": "^5.2",
6161
"http-interop/http-factory-tests": "^2.0",
6262
"mikey179/vfsstream": "^1.6.10",
6363
"mockery/mockery": "^1.6",

src/Collection/CollectionTrait.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function each(callable $callback)
8282
*/
8383
public function filter(?callable $callback = null): CollectionInterface
8484
{
85-
$callback ??= fn ($v) => (bool)$v;
85+
$callback ??= fn($v) => (bool)$v;
8686

8787
return new FilterIterator($this->unwrap(), $callback);
8888
}
@@ -92,17 +92,17 @@ public function filter(?callable $callback = null): CollectionInterface
9292
*/
9393
public function reject(?callable $callback = null): CollectionInterface
9494
{
95-
$callback ??= fn ($v) => (bool)$v;
95+
$callback ??= fn($v) => (bool)$v;
9696

97-
return new FilterIterator($this->unwrap(), fn ($value, $key, $items) => !$callback($value, $key, $items));
97+
return new FilterIterator($this->unwrap(), fn($value, $key, $items) => !$callback($value, $key, $items));
9898
}
9999

100100
/**
101101
* @inheritDoc
102102
*/
103103
public function unique(?callable $callback = null): CollectionInterface
104104
{
105-
$callback ??= fn ($v) => $v;
105+
$callback ??= fn($v) => $v;
106106

107107
return new UniqueIterator($this->unwrap(), $callback);
108108
}
@@ -373,8 +373,8 @@ public function countBy(callable|string $path): CollectionInterface
373373
{
374374
$callback = $this->_propertyExtractor($path);
375375

376-
$mapper = fn ($value, $key, MapReduce $mr) => $mr->emitIntermediate($value, $callback($value));
377-
$reducer = fn ($values, $key, MapReduce $mr) => $mr->emit(count($values), $key);
376+
$mapper = fn($value, $key, MapReduce $mr) => $mr->emitIntermediate($value, $callback($value));
377+
$reducer = fn($values, $key, MapReduce $mr) => $mr->emit(count($values), $key);
378378

379379
return $this->newCollection(new MapReduce($this->unwrap(), $mapper, $reducer));
380380
}
@@ -877,7 +877,7 @@ public function stopWhen(callable|array $condition): CollectionInterface
877877
*/
878878
public function unfold(?callable $callback = null): CollectionInterface
879879
{
880-
$callback ??= fn ($v) => $v;
880+
$callback ??= fn($v) => $v;
881881

882882
return $this->newCollection(
883883
new RecursiveIteratorIterator(

src/Collection/ExtractTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function _propertyExtractor(callable|string $path): Closure
4343
$parts = explode('.', $path);
4444

4545
if (str_contains($path, '{*}')) {
46-
return fn ($element) => $this->_extract($element, $parts);
46+
return fn($element) => $this->_extract($element, $parts);
4747
}
4848

4949
return function ($element) use ($parts) {

src/Command/Helper/BannerHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function withStyle(string $style)
7474
*/
7575
public function output(array $args): void
7676
{
77-
$lengths = array_map(fn ($i) => mb_strlen($i), $args);
77+
$lengths = array_map(fn($i) => mb_strlen($i), $args);
7878
$maxLength = max($lengths);
7979
$bannerLength = $maxLength + $this->padding * 2;
8080
$start = "<{$this->style}>";

src/Database/Connection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public function getDriver(string $role = self::ROLE_WRITE): Driver
265265
*/
266266
public function execute(string $sql, array $params = [], array $types = []): StatementInterface
267267
{
268-
return $this->getDisconnectRetry()->run(fn () => $this->getDriver()->execute($sql, $params, $types));
268+
return $this->getDisconnectRetry()->run(fn() => $this->getDriver()->execute($sql, $params, $types));
269269
}
270270

271271
/**
@@ -277,7 +277,7 @@ public function execute(string $sql, array $params = [], array $types = []): Sta
277277
*/
278278
public function run(Query $query): StatementInterface
279279
{
280-
return $this->getDisconnectRetry()->run(fn () => $this->getDriver($query->getConnectionRole())->run($query));
280+
return $this->getDisconnectRetry()->run(fn() => $this->getDriver($query->getConnectionRole())->run($query));
281281
}
282282

283283
/**

src/Database/Driver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function config(): array
187187
*/
188188
protected function createPdo(string $dsn, array $config): PDO
189189
{
190-
$action = fn (): PDO => new PDO(
190+
$action = fn(): PDO => new PDO(
191191
$dsn,
192192
$config['username'] ?: null,
193193
$config['password'] ?: null,

src/Database/Expression/CommonTableExpression.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function sql(ValueBinder $binder): string
187187
{
188188
$fields = '';
189189
if ($this->fields) {
190-
$expressions = array_map(fn (IdentifierExpression $e) => $e->sql($binder), $this->fields);
190+
$expressions = array_map(fn(IdentifierExpression $e) => $e->sql($binder), $this->fields);
191191
$fields = sprintf('(%s)', implode(', ', $expressions));
192192
}
193193

src/Database/Query.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,7 @@ public function clause(string $name): mixed
16071607
{
16081608
if (!array_key_exists($name, $this->_parts)) {
16091609
$clauses = array_keys($this->_parts);
1610-
array_walk($clauses, fn (&$x) => $x = "`{$x}`");
1610+
array_walk($clauses, fn(&$x) => $x = "`{$x}`");
16111611
$clauses = implode(', ', $clauses);
16121612
throw new InvalidArgumentException(sprintf(
16131613
'The `%s` clause is not defined. Valid clauses are: %s.',
@@ -1660,7 +1660,7 @@ protected function _expressionsVisitor(mixed $expression, Closure $callback): vo
16601660
}
16611661

16621662
if ($expression instanceof ExpressionInterface) {
1663-
$expression->traverse(fn ($exp) => $this->_expressionsVisitor($exp, $callback));
1663+
$expression->traverse(fn($exp) => $this->_expressionsVisitor($exp, $callback));
16641664

16651665
if (!$expression instanceof self) {
16661666
$callback($expression);

src/Database/Schema/SqliteSchemaDialect.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ public function convertIndexDescription(TableSchema $schema, array $row): void
388388
$columnsPattern = implode(
389389
'\s*,\s*',
390390
array_map(
391-
fn ($column) => '(?:' . $this->possiblyQuotedIdentifierRegex($column) . ')',
391+
fn($column) => '(?:' . $this->possiblyQuotedIdentifierRegex($column) . ')',
392392
$columns,
393393
),
394394
);

src/Datasource/EntityTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ public function setInvalidField(string $field, mixed $value)
12891289
public function setAccess(array|string $field, bool $set)
12901290
{
12911291
if ($field === '*') {
1292-
$this->_accessible = array_map(fn ($p) => $set, $this->_accessible);
1292+
$this->_accessible = array_map(fn($p) => $set, $this->_accessible);
12931293
$this->_accessible['*'] = $set;
12941294

12951295
return $this;

0 commit comments

Comments
 (0)