Skip to content

Commit 0ec5365

Browse files
committed
fix
1 parent a4affab commit 0ec5365

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/ArrayHelper.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,7 @@ private static function parseMixedPath(array|float|int|string $path, string $del
14401440
/**
14411441
* @param array $array The array that should be searched
14421442
* @param Closure $predicate The predicate callback to call to check each element. The first parameter contains the value, the second parameter contains the corresponding key. If this function returns truthy value, the value is returned from `find()` and the callback will not be called for further elements
1443-
*
1443+
*
14441444
* @return mixed Returns the value of the first element for which the `$predicate` callback returns true. If no matching element is found the function returns `null`
14451445
*/
14461446
public static function find(array $array, Closure $predicate): mixed
@@ -1457,7 +1457,7 @@ public static function find(array $array, Closure $predicate): mixed
14571457
/**
14581458
* @param array The array that should be searched
14591459
* @param Closure $predicate The predicate callback to call to check each element. The first parameter contains the value, the second parameter contains the corresponding key. If this function returns truthy value, the key is returned from `findKey()` and the callback will not be called for further elements
1460-
*
1460+
*
14611461
* @return string|int|null Returns the key of the first element for which the `$predicate` callback returns `true`. If no matching element is found the function returns `null`
14621462
*/
14631463
public static function findKey(array $array, Closure $predicate): string|int|null
@@ -1474,7 +1474,7 @@ public static function findKey(array $array, Closure $predicate): string|int|nul
14741474
/**
14751475
* @param array The array that should be searched
14761476
* @param Closure $predicate The predicate callback to call to check each element. The first parameter contains the value, the second parameter contains the corresponding key. If this function returns truthy value, `true` is returned from `any()` and the callback will not be called for further elements
1477-
*
1477+
*
14781478
* @return bool Returns `true`, if one element for which predicate callback returns truthy value. Otherwise the function returns `false`
14791479
*/
14801480
public static function any(array $array, Closure $predicate): bool
@@ -1491,7 +1491,7 @@ public static function any(array $array, Closure $predicate): bool
14911491
/**
14921492
* @param array The array that should be searched
14931493
* @param Closure $predicate The predicate callback to call to check each element. The first parameter contains the value, the second parameter contains the corresponding key. If this function returns falsy value, `false` is returned from `all()` and the callback will not be called for further elements
1494-
*
1494+
*
14951495
* @return bool Returns `false`, if one element for which predicate callback returns truthy value. Otherwise the function returns `false`
14961496
*/
14971497
public static function all(array $array, Closure $predicate): bool

tests/ArrayHelper/FindTest.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ final class FindTest extends TestCase
1212
{
1313
private array $array = [
1414
[
15-
"a" => 1,
16-
"b" => 2,
17-
"c" => 3,
18-
"d" => 4,
19-
"e" => 5,
15+
'a' => 1,
16+
'b' => 2,
17+
'c' => 3,
18+
'd' => 4,
19+
'e' => 5,
2020
],
2121
[
22-
1, 2, 3, 4, 5
22+
1, 2, 3, 4, 5,
2323
],
2424
];
2525

@@ -29,7 +29,7 @@ public function dataProviderFindFromArray(): array
2929
[$this->array[0], fn ($value) => $value > 3, 4],
3030
[$this->array[1], fn ($value) => $value > 3, 4],
3131
[$this->array[1], fn ($value) => $value > 5, null],
32-
[$this->array[0], fn ($value, $key) => $key === "c", 3],
32+
[$this->array[0], fn ($value, $key) => $key === 'c', 3],
3333
[$this->array[0], fn () => false, null],
3434
[[], fn () => true, null],
3535
];
@@ -49,10 +49,10 @@ public function testFind($array, $predicate, $expected): void
4949
public function dataProviderFindKeyFromArray(): array
5050
{
5151
return [
52-
[$this->array[0], fn ($value) => $value > 3, "d"],
52+
[$this->array[0], fn ($value) => $value > 3, 'd'],
5353
[$this->array[1], fn ($value) => $value > 3, 3],
5454
[$this->array[1], fn ($value) => $value > 5, null],
55-
[$this->array[0], fn ($value, $key) => $key === "c", "c"],
55+
[$this->array[0], fn ($value, $key) => $key === 'c', 'c'],
5656
[$this->array[0], fn () => false, null],
5757
[[], fn () => true, null],
5858
];
@@ -75,7 +75,7 @@ public function dataProviderAnyFromArray(): array
7575
[$this->array[0], fn ($value) => $value > 3, true],
7676
[$this->array[1], fn ($value) => $value > 3, true],
7777
[$this->array[1], fn ($value) => $value > 5, false],
78-
[$this->array[0], fn ($value, $key) => $key === "c", true],
78+
[$this->array[0], fn ($value, $key) => $key === 'c', true],
7979
[$this->array[0], fn () => false, false],
8080
[[], fn () => true, false],
8181
];

0 commit comments

Comments
 (0)