From 5f891435f1c94db9e074407a74815e1f37ab32ec Mon Sep 17 00:00:00 2001 From: Menno Holtkamp Date: Tue, 14 Apr 2015 16:02:36 +0200 Subject: [PATCH] Use early return --- lib/Doctrine/ORM/Cache/Region/DefaultRegion.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/Doctrine/ORM/Cache/Region/DefaultRegion.php b/lib/Doctrine/ORM/Cache/Region/DefaultRegion.php index 324e27544..3f214d0b0 100644 --- a/lib/Doctrine/ORM/Cache/Region/DefaultRegion.php +++ b/lib/Doctrine/ORM/Cache/Region/DefaultRegion.php @@ -105,13 +105,14 @@ class DefaultRegion implements Region $result = array(); foreach ($collection->identifiers as $key) { - $entry = $this->cache->fetch($this->getCacheEntryKey($key)); - if ($entry === false) { - $result = null; - break; - } else { - $result[] = $entry; + $entryKey = $this->getCacheEntryKey($key); + $entryValue = $this->cache->fetch($entryKey); + + if ($entryValue === false) { + return null; } + + $result[] = $entryValue; } return $result;