Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Minor performance optimization for lookups

  • Loading branch information...
commit a152e34952ffcdfc04973b9018f6e5e96c8cabbf 1 parent a890fe1
@Ocramius Ocramius authored
Showing with 1 addition and 7 deletions.
  1. +1 −7 lib/Doctrine/Common/Collections/ArrayCollection.php
View
8 lib/Doctrine/Common/Collections/ArrayCollection.php
@@ -229,13 +229,7 @@ public function containsKey($key)
*/
public function contains($element)
{
- foreach ($this->_elements as $collectionElement) {
- if ($element === $collectionElement) {
- return true;
- }
- }
-
- return false;
+ return in_array($element, $this->_elements, true);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.