Permalink
Browse files

Minor performance optimization for lookups

  • Loading branch information...
1 parent a890fe1 commit a152e34952ffcdfc04973b9018f6e5e96c8cabbf @Ocramius Ocramius committed Jan 8, 2013
Showing with 1 addition and 7 deletions.
  1. +1 −7 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);
}
/**

0 comments on commit a152e34

Please sign in to comment.