From 7aba665e484c5c36ee029219a999a427d864ff22 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Tue, 6 Dec 2016 22:17:44 -0500 Subject: Avoid returning objects passed by reference. Objects are always passed by reference, so it doesn't make sense to return an object which is passed by reference as it will always be the same object. This change makes the code a bit more readable. --- src/Wallabag/CoreBundle/Controller/EntryController.php | 8 ++------ src/Wallabag/CoreBundle/Helper/ContentProxy.php | 4 ---- 2 files changed, 2 insertions(+), 10 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 8d2ac6d4..6018dfac 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -53,12 +53,10 @@ class EntryController extends Controller /** * Fetch content and update entry. - * In case it fails, entry will return to avod loosing the data. + * In case it fails, $entry->getContent will return an error message. * * @param Entry $entry * @param string $prefixMessage Should be the translation key: entry_saved or entry_reloaded - * - * @return Entry */ private function updateEntry(Entry $entry, $prefixMessage = 'entry_saved') { @@ -68,7 +66,7 @@ class EntryController extends Controller $message = 'flashes.entry.notice.'.$prefixMessage; try { - $entry = $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl()); + $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl()); } catch (\Exception $e) { $this->get('logger')->error('Error while saving an entry', [ 'exception' => $e, @@ -79,8 +77,6 @@ class EntryController extends Controller } $this->get('session')->getFlashBag()->add('notice', $message); - - return $entry; } /** diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 8ba77ca9..c73b8eaf 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php @@ -40,8 +40,6 @@ class ContentProxy * @param Entry $entry Entry to update * @param string $url Url to grab content for * @param array $content An array with AT LEAST keys title, html, url to skip the fetchContent from the url - * - * @return Entry */ public function updateEntry(Entry $entry, $url, array $content = []) { @@ -130,8 +128,6 @@ class ContentProxy 'error_msg' => $e->getMessage(), ]); } - - return $entry; } /** -- cgit v1.2.3