Skip to content

Commit 340de38

Browse files
committed
1 parent 62286ff commit 340de38

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Sequence.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ function contains(...$values): bool;
7070
function filter(callable $callback = null): Sequence;
7171

7272
/**
73-
* Returns the index of a given value, or false if it could not be found.
73+
* Returns the index of a given value, or null if it could not be found.
7474
*
7575
* @param mixed $value
7676
*
77-
* @return int|false
77+
* @return int|null
7878
*
7979
* @psalm-param TValue $value
8080
*/

src/Traits/GenericSequence.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function count(): int
8080
public function contains(...$values): bool
8181
{
8282
foreach ($values as $value) {
83-
if ($this->find($value) === false) {
83+
if ($this->find($value) === null) {
8484
return false;
8585
}
8686
}
@@ -101,7 +101,9 @@ public function filter(callable $callback = null): Sequence
101101
*/
102102
public function find($value)
103103
{
104-
return array_search($value, $this->array, true);
104+
$offset = array_search($value, $this->array, true);
105+
106+
return $offset === false ? null : $offset;
105107
}
106108

107109
/**

0 commit comments

Comments
 (0)