Skip to content

Commit 08536e1

Browse files
committed
Remove equals method
1 parent b3c3053 commit 08536e1

File tree

2 files changed

+0
-49
lines changed

2 files changed

+0
-49
lines changed

src/Enum.php

-12
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,6 @@ public function __wakeup()
8181
}
8282
}
8383

84-
/**
85-
* Compares one Enum with another.
86-
*
87-
* This method is final, for more information read https://github.com/myclabs/php-enum/issues/4
88-
*
89-
* @return bool True if Enums are equal, false if not equal
90-
*/
91-
final public function equals(Enum $enum)
92-
{
93-
return $this->getValue() === $enum->getValue() && get_called_class() == get_class($enum);
94-
}
95-
9684
/**
9785
* Returns the names (keys) of all constants in the Enum class
9886
*

tests/EnumTest.php

-37
Original file line numberDiff line numberDiff line change
@@ -201,20 +201,6 @@ public function searchProvider() {
201201
);
202202
}
203203

204-
/**
205-
* equals()
206-
*/
207-
public function testEquals()
208-
{
209-
$foo = EnumFixture::FOO();
210-
$number = EnumFixture::NUMBER();
211-
$anotherFoo = EnumFixture::FOO();
212-
213-
$this->assertTrue($foo->equals($foo));
214-
$this->assertFalse($foo->equals($number));
215-
$this->assertTrue($foo->equals($anotherFoo));
216-
}
217-
218204
/**
219205
* __callStatic()
220206
*/
@@ -226,29 +212,6 @@ public function testSameInstance()
226212
$this->assertSame($foo1, $foo2);
227213
}
228214

229-
/**
230-
* equals()
231-
*/
232-
public function testEqualsComparesProblematicValuesProperly()
233-
{
234-
$false = EnumFixture::PROBLEMATIC_BOOLEAN_FALSE();
235-
$emptyString = EnumFixture::PROBLEMATIC_EMPTY_STRING();
236-
$null = EnumFixture::PROBLEMATIC_NULL();
237-
238-
$this->assertTrue($false->equals($false));
239-
$this->assertFalse($false->equals($emptyString));
240-
$this->assertFalse($emptyString->equals($null));
241-
$this->assertFalse($null->equals($false));
242-
}
243-
244-
/**
245-
* equals()
246-
*/
247-
public function testEqualsConflictValues()
248-
{
249-
$this->assertFalse(EnumFixture::FOO()->equals(EnumConflict::FOO()));
250-
}
251-
252215
/**
253216
* fromKey()
254217
*/

0 commit comments

Comments
 (0)