From 82cd6f5a44fd2144df09c28d8f5d7912a56b47d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Borys=20=C5=BBmuda?= Date: Fri, 27 Sep 2024 08:03:31 +0200 Subject: [PATCH] docs: Added `Set::keys()` documentation --- docs/Set.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/Set.md b/docs/Set.md index 10bb4bf..6b42e8f 100644 --- a/docs/Set.md +++ b/docs/Set.md @@ -11,6 +11,7 @@ The Set object holds only unique values of any type. - [`Set::entries()`](#setentries) - [`Set::forEach()`](#setforeach) - [`Set::has()`](#sethas) +- [`Set::keys()`](#setkeys) - [`Set::values()`](#setvalues) - [`Set::size`](#setsize) @@ -128,6 +129,20 @@ $set->has(6); // false ``` +### Set::keys() + +The `keys()` method is exactly equivalent to the [values()](#setvalues) method. + +```php +$set = new Set(['foo' => 'bar']); + +$iterator = $set->keys(); +// [object SetIterator] + +$iterator->current(); +// 'foo' +``` + ### Set::values() The `values()` method returns a new `SetIterator` instance that contain the values of each element of the Set.