Skip to content

Commit a780330

Browse files
committed
implementes #120: consistent method naming
1 parent ae8e926 commit a780330

File tree

5 files changed

+754
-666
lines changed

5 files changed

+754
-666
lines changed

src/EnumMap.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ public function search($value, bool $strict = false)
238238
* Test if the given enumerator key (object or value) exists.
239239
* @param Enum|null|bool|int|float|string|array $enumerator
240240
* @return bool
241-
* @see offsetExists
241+
* @see offsetExists()
242242
*/
243-
public function contains($enumerator): bool
243+
public function has($enumerator): bool
244244
{
245245
try {
246246
$ord = ($this->enumeration)::get($enumerator)->getOrdinal();
@@ -251,13 +251,26 @@ public function contains($enumerator): bool
251251
}
252252
}
253253

254+
/**
255+
* Test if the given enumerator key (object or value) exists.
256+
* @param Enum|null|bool|int|float|string|array $enumerator
257+
* @return bool
258+
* @see offsetExists()
259+
* @see has()
260+
* @deprecated Will trigger deprecation warning in last 4.x and removed in 5.x
261+
*/
262+
public function contains($enumerator): bool
263+
{
264+
return $this->has($enumerator);
265+
}
266+
254267
/* ArrayAccess */
255268

256269
/**
257270
* Test if the given enumerator key (object or value) exists and is not NULL
258271
* @param Enum|null|bool|int|float|string|array $enumerator
259272
* @return bool
260-
* @see contains
273+
* @see contains()
261274
*/
262275
public function offsetExists($enumerator): bool
263276
{

0 commit comments

Comments
 (0)