Skip to content

Commit 0312b8d

Browse files
committed
refactor(support): change methods and tests to withKeys and withoutKeys
1 parent ba637c2 commit 0312b8d

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

packages/support/src/Arr/ManipulatesArray.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public function intersectKeys(array|self ...$arrays): self
332332
*
333333
* @return static<TKey, TValue>
334334
*/
335-
public function onlyKeys(array|self ...$arrays): self
335+
public function withKeys(array|self ...$arrays): self
336336
{
337337
return $this->createOrModify(namespace\intersect_keys($this->value, array_flip(...$arrays)));
338338
}
@@ -345,7 +345,7 @@ public function onlyKeys(array|self ...$arrays): self
345345
*
346346
* @return static<TKey, TValue>
347347
*/
348-
public function exceptKeys(array|self ...$arrays): self
348+
public function withoutKeys(array|self ...$arrays): self
349349
{
350350
return $this->createOrModify(namespace\diff_keys($this->value, array_flip(...$arrays)));
351351
}

packages/support/tests/Arr/ManipulatesArrayTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -574,15 +574,15 @@ public function test_intersect_keys(): void
574574
$this->assertSame($expected, $current);
575575
}
576576

577-
public function test_only_keys(): void
577+
public function test_with_keys(): void
578578
{
579579
$collection = arr([
580580
'first_name' => 'John',
581581
'last_name' => 'Doe',
582582
'age' => 42,
583583
]);
584584
$current = $collection
585-
->onlyKeys(['first_name', 'last_name'])
585+
->withKeys(['first_name', 'last_name'])
586586
->toArray();
587587
$expected = [
588588
'first_name' => 'John',
@@ -592,15 +592,15 @@ public function test_only_keys(): void
592592
$this->assertSame($expected, $current);
593593
}
594594

595-
public function test_except_keys(): void
595+
public function test_without_keys(): void
596596
{
597597
$collection = arr([
598598
'first_name' => 'John',
599599
'last_name' => 'Doe',
600600
'age' => 42,
601601
]);
602602
$current = $collection
603-
->exceptKeys(['age'])
603+
->withoutKeys(['age'])
604604
->toArray();
605605
$expected = [
606606
'first_name' => 'John',

0 commit comments

Comments
 (0)