From d8148eeefa96cdc9d58a82f7759814aaf0084914 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 8 Aug 2019 13:03:58 +1200 Subject: [PATCH] dev/core#1001 fix php 7.2 coun warning errors --- CRM/Contribute/Import/Parser.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/CRM/Contribute/Import/Parser.php b/CRM/Contribute/Import/Parser.php index 9ceac6a63d..24c30758c8 100644 --- a/CRM/Contribute/Import/Parser.php +++ b/CRM/Contribute/Import/Parser.php @@ -427,20 +427,34 @@ abstract class CRM_Contribute_Import_Parser extends CRM_Import_Parser { } /** + * Store the soft credit field information. + * + * This was perhaps done this way on the believe that a lot of code pain + * was worth it to avoid negligible-cost array iterations. Perhaps we could prioritise + * readability & maintainability next since we can just work with functions to retrieve + * data from the metadata. + * * @param array $elements */ public function setActiveFieldSoftCredit($elements) { - for ($i = 0; $i < count($elements); $i++) { - $this->_activeFields[$i]->_softCreditField = $elements[$i]; + foreach ((array) $elements as $i => $element) { + $this->_activeFields[$i]->_softCreditField = $element; } } /** + * Store the soft credit field type information. + * + * This was perhaps done this way on the believe that a lot of code pain + * was worth it to avoid negligible-cost array iterations. Perhaps we could prioritise + * readability & maintainability next since we can just work with functions to retrieve + * data from the metadata. + * * @param array $elements */ public function setActiveFieldSoftCreditType($elements) { - for ($i = 0; $i < count($elements); $i++) { - $this->_activeFields[$i]->_softCreditType = $elements[$i]; + foreach ((array) $elements as $i => $element) { + $this->_activeFields[$i]->_softCreditType = $element; } } -- 2.25.1