From 08d892eb6ce5e884eccf1dcd18da118809492b60 Mon Sep 17 00:00:00 2001 From: Anders Persson Date: Tue, 29 Jan 2013 10:38:14 +0100 Subject: [PATCH 1/4] optimized element additions --- .../core/Mage/Adminhtml/Block/Dashboard/Graph.php | 10 +++++----- app/code/core/Mage/Bundle/Model/Option.php | 2 +- app/code/core/Mage/Connect/Model/Session.php | 6 +++--- app/code/core/Mage/Core/Model/Email/Info.php | 8 ++++---- .../core/Mage/Core/Model/Email/Template/Mailer.php | 2 +- app/code/core/Mage/Core/Model/Store/Group.php | 2 +- app/code/core/Mage/Core/Model/Theme/Registration.php | 2 +- .../Mage/Customer/controllers/AccountController.php | 2 +- app/code/core/Mage/Sales/Model/Quote.php | 2 +- .../Usa/Model/Shipping/Carrier/Dhl/Label/Pdf.php | 2 +- app/code/core/Mage/User/Block/Role/Tab/Edit.php | 2 +- .../User/controllers/Adminhtml/AuthController.php | 5 +---- dev/tests/js/run_js_tests.php | 4 ++-- downloader/lib/Mage/Connect/Frontend.php | 4 ++-- downloader/lib/Mage/Connect/Package.php | 6 +++--- lib/Mage/Connect/Frontend.php | 4 ++-- lib/Magento/Di/Zend.php | 6 +++--- lib/PEAR/PEAR.php | 4 ++-- lib/PEAR/PEAR/PEAR.php | 4 ++-- lib/PEAR/XML/Parser/Simple.php | 4 ++-- lib/PEAR/XML/Unserializer.php | 12 ++++++------ lib/Varien/Data/Tree/Node.php | 2 +- lib/Varien/Io/Abstract.php | 2 +- lib/Zend/Cloud/StorageService/Adapter/Nirvanix.php | 4 ++-- lib/Zend/Code/Reflection/MethodReflection.php | 2 +- lib/Zend/Code/Scanner/DocBlockScanner.php | 6 ++++-- lib/Zend/Controller/Plugin/ActionStack.php | 2 +- lib/Zend/Db/Select.php | 4 ++-- lib/Zend/Di/Di.php | 6 +++--- lib/Zend/Filter/Compress/Zip.php | 2 +- lib/Zend/Filter/RealPath.php | 2 +- lib/Zend/Json/Server.php | 4 ++-- lib/Zend/Loader/Autoloader.php | 4 ++-- lib/Zend/Mail/Protocol/Imap.php | 2 +- lib/Zend/Mail/Storage/Folder/Maildir.php | 4 ++-- lib/Zend/Mail/Storage/Imap.php | 4 ++-- lib/Zend/Reflection/Method.php | 2 +- lib/Zend/Service/Amazon/Item.php | 2 +- lib/Zend/Test/DbAdapter.php | 4 ++-- lib/Zend/Tool/Framework/Client/Console.php | 2 +- .../Tool/Framework/Client/Console/ArgumentParser.php | 2 +- .../Project/Context/Zf/ApplicationConfigFile.php | 4 ++-- lib/Zend/Tool/Project/Profile/Resource/Container.php | 2 +- .../Project/Profile/Resource/SearchConstraints.php | 2 +- lib/Zend/Tool/Project/Provider/Module.php | 2 +- lib/Zend/Wildfire/Plugin/FirePhp.php | 2 +- 46 files changed, 83 insertions(+), 84 deletions(-) diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php index 64e979bcdccf3..4db432f2e5ff6 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php @@ -311,9 +311,9 @@ public function getChartUrl($directUrl = true) $currentvalue = $thisdataarray[$j]; if (is_numeric($currentvalue)) { $ylocation = round((strlen($this->_simpleEncoding)-1) * ($yorigin + $currentvalue) / $yrange); - array_push($chartdata, substr($this->_simpleEncoding, $ylocation, 1) . $dataDelimiter); + $chartdata[] = substr($this->_simpleEncoding, $ylocation, 1) . $dataDelimiter; } else { - array_push($chartdata, $dataMissing . $dataDelimiter); + $chartdata[] = $dataMissing . $dataDelimiter; } } // END SIMPLE ENCODING @@ -331,14 +331,14 @@ public function getChartUrl($directUrl = true) $secondchar = $ylocation % 64; $mappedchar = substr($this->_extendedEncoding, $firstchar, 1) . substr($this->_extendedEncoding, $secondchar, 1); - array_push($chartdata, $mappedchar . $dataDelimiter); + $chartdata[] = $mappedchar . $dataDelimiter; } else { - array_push($chartdata, $dataMissing . $dataDelimiter); + $chartdata[] = $dataMissing . $dataDelimiter; } } // ============= END EXTENDED ENCODING ============= } - array_push($chartdata, $dataSetdelimiter); + $chartdata[] = $dataSetdelimiter; } $buffer = implode('', $chartdata); diff --git a/app/code/core/Mage/Bundle/Model/Option.php b/app/code/core/Mage/Bundle/Model/Option.php index 08b973b0ce9b7..29ea42593e296 100644 --- a/app/code/core/Mage/Bundle/Model/Option.php +++ b/app/code/core/Mage/Bundle/Model/Option.php @@ -75,7 +75,7 @@ public function addSelection($selection) if (!$selections = $this->getData('selections')) { $selections = array(); } - array_push($selections, $selection); + $selections[] = $selection; $this->setSelections($selections); return $this; } diff --git a/app/code/core/Mage/Connect/Model/Session.php b/app/code/core/Mage/Connect/Model/Session.php index 1a3c5046590b5..cf87d0600416e 100644 --- a/app/code/core/Mage/Connect/Model/Session.php +++ b/app/code/core/Mage/Connect/Model/Session.php @@ -65,9 +65,9 @@ public function getCustomExtensionPackageFormData() ) { continue; } - array_push($data['authors']['name'], $data['maintainers']['name'][$i]); - array_push($data['authors']['user'], $data['maintainers']['handle'][$i]); - array_push($data['authors']['email'], $data['maintainers']['email'][$i]); + $data['authors']['name'][] = $data['maintainers']['name'][$i]; + $data['authors']['user'][] = $data['maintainers']['handle'][$i]; + $data['authors']['email'][] = $data['maintainers']['email'][$i]; } // Convert channel from previous version for entire package $helper = Mage::helper('Mage_Connect_Helper_Data'); diff --git a/app/code/core/Mage/Core/Model/Email/Info.php b/app/code/core/Mage/Core/Model/Email/Info.php index c48a9dce7ac8c..cec98bfdf2a73 100644 --- a/app/code/core/Mage/Core/Model/Email/Info.php +++ b/app/code/core/Mage/Core/Model/Email/Info.php @@ -76,8 +76,8 @@ class Mage_Core_Model_Email_Info extends Varien_Object */ public function addBcc($email, $name = null) { - array_push($this->_bccNames, $name); - array_push($this->_bccEmails, $email); + $this->_bccNames[] = $name; + $this->_bccEmails[] = $email; return $this; } @@ -90,8 +90,8 @@ public function addBcc($email, $name = null) */ public function addTo($email, $name = null) { - array_push($this->_toNames, $name); - array_push($this->_toEmails, $email); + $this->_toNames[] = $name; + $this->_toEmails[] = $email; return $this; } diff --git a/app/code/core/Mage/Core/Model/Email/Template/Mailer.php b/app/code/core/Mage/Core/Model/Email/Template/Mailer.php index 0bff785478a49..644edf188bfe4 100644 --- a/app/code/core/Mage/Core/Model/Email/Template/Mailer.php +++ b/app/code/core/Mage/Core/Model/Email/Template/Mailer.php @@ -49,7 +49,7 @@ class Mage_Core_Model_Email_Template_Mailer extends Varien_Object */ public function addEmailInfo(Mage_Core_Model_Email_Info $emailInfo) { - array_push($this->_emailInfos, $emailInfo); + $this->_emailInfos[] = $emailInfo; return $this; } diff --git a/app/code/core/Mage/Core/Model/Store/Group.php b/app/code/core/Mage/Core/Model/Store/Group.php index f53b7712b0627..96e7a01e5e6b2 100644 --- a/app/code/core/Mage/Core/Model/Store/Group.php +++ b/app/code/core/Mage/Core/Model/Store/Group.php @@ -261,7 +261,7 @@ public function getStoresByLocale($locale) foreach ($this->getStores() as $store) { /* @var $store Mage_Core_Model_Store */ if ($store->getLocaleCode() == $locale) { - array_push($stores, $store); + $stores[] = $store; } } return $stores; diff --git a/app/code/core/Mage/Core/Model/Theme/Registration.php b/app/code/core/Mage/Core/Model/Theme/Registration.php index 4ba0e34826e0b..eb1c1940bf0ff 100644 --- a/app/code/core/Mage/Core/Model/Theme/Registration.php +++ b/app/code/core/Mage/Core/Model/Theme/Registration.php @@ -128,7 +128,7 @@ protected function _registerThemeRecursively(&$theme, $inheritanceChain = array( Mage::throwException(Mage::helper('Mage_Core_Helper_Data') ->__('Circular-reference in theme inheritance detected for "%s"', $tempId)); } - array_push($inheritanceChain, $tempId); + $inheritanceChain[] = $tempId; $parentTheme = $theme->getParentTheme(); if ($parentTheme) { $this->_registerThemeRecursively($parentTheme, $inheritanceChain); diff --git a/app/code/core/Mage/Customer/controllers/AccountController.php b/app/code/core/Mage/Customer/controllers/AccountController.php index f4f46a35b43d9..23bd4242cd7eb 100644 --- a/app/code/core/Mage/Customer/controllers/AccountController.php +++ b/app/code/core/Mage/Customer/controllers/AccountController.php @@ -644,7 +644,7 @@ public function resetPasswordPostAction() $errorMessages = array(); if (iconv_strlen($password) <= 0) { - array_push($errorMessages, Mage::helper('Mage_Customer_Helper_Data')->__('New password field cannot be empty.')); + $errorMessages[] = Mage::helper('Mage_Customer_Helper_Data')->__('New password field cannot be empty.'); } /** @var $customer Mage_Customer_Model_Customer */ $customer = Mage::getModel('Mage_Customer_Model_Customer')->load($customerId); diff --git a/app/code/core/Mage/Sales/Model/Quote.php b/app/code/core/Mage/Sales/Model/Quote.php index ae3c29c909526..09c9fc41d9afe 100644 --- a/app/code/core/Mage/Sales/Model/Quote.php +++ b/app/code/core/Mage/Sales/Model/Quote.php @@ -1454,7 +1454,7 @@ public function getErrors() foreach ($this->getMessages() as $message) { /* @var $error Mage_Core_Model_Message_Abstract */ if ($message->getType() == Mage_Core_Model_Message::ERROR) { - array_push($errors, $message); + $errors[] = $message; } } return $errors; diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf.php index 29afb8d8969a3..f3d5efa82fb2f 100644 --- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf.php +++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf.php @@ -108,7 +108,7 @@ public function render() (string)$piece->LicensePlate, (string)$piece->LicensePlateBarCode ); - array_push($pdf->pages, $page); + $pdf->pages[] = $page; $i++; } return $pdf->render(); diff --git a/app/code/core/Mage/User/Block/Role/Tab/Edit.php b/app/code/core/Mage/User/Block/Role/Tab/Edit.php index 745c4652458be..62c7a78900c1b 100644 --- a/app/code/core/Mage/User/Block/Role/Tab/Edit.php +++ b/app/code/core/Mage/User/Block/Role/Tab/Edit.php @@ -103,7 +103,7 @@ protected function _construct() foreach ($rulesSet->getItems() as $item) { $itemResourceId = $item->getResource_id(); if ($acl->has($itemResourceId) && $item->getPermission() == 'allow') { - array_push($selectedResourceIds, $itemResourceId); + $selectedResourceIds[] = $itemResourceId; } } diff --git a/app/code/core/Mage/User/controllers/Adminhtml/AuthController.php b/app/code/core/Mage/User/controllers/Adminhtml/AuthController.php index 8efa1f219b266..fc226bac7ce5f 100644 --- a/app/code/core/Mage/User/controllers/Adminhtml/AuthController.php +++ b/app/code/core/Mage/User/controllers/Adminhtml/AuthController.php @@ -132,10 +132,7 @@ public function resetPasswordPostAction() $errorMessages = array(); if (iconv_strlen($password) <= 0) { - array_push( - $errorMessages, - Mage::helper('Mage_User_Helper_Data')->__('New password field cannot be empty.') - ); + $errorMessages[] = Mage::helper('Mage_User_Helper_Data')->__('New password field cannot be empty.'); } /** @var $user Mage_User_Model_User */ $user = Mage::getModel('Mage_User_Model_User')->load($userId); diff --git a/dev/tests/js/run_js_tests.php b/dev/tests/js/run_js_tests.php index c60aa73faa8f1..db83caad176f8 100644 --- a/dev/tests/js/run_js_tests.php +++ b/dev/tests/js/run_js_tests.php @@ -94,7 +94,7 @@ } } if (!$found) { - array_push($sortedFiles, $loadFile); + $sortedFiles[] = $loadFile; } } } @@ -226,7 +226,7 @@ function listFiles($dirs) $path = $baseDir . $dir; if (is_file($path)) { $path = substr_replace($path, RELATIVE_APP_ROOT, 0, strlen($baseDir)); - array_push($result, $path); + $result[] = $path; } else { $paths = glob($path . '/*', GLOB_ONLYDIR | GLOB_NOSORT); $paths = substr_replace($paths, '', 0, strlen($baseDir)); diff --git a/downloader/lib/Mage/Connect/Frontend.php b/downloader/lib/Mage/Connect/Frontend.php index 2ab56f05294bf..2492284110483 100644 --- a/downloader/lib/Mage/Connect/Frontend.php +++ b/downloader/lib/Mage/Connect/Frontend.php @@ -127,7 +127,7 @@ public function doError($command, $message) */ public function pushCapture() { - array_push($this->_captureSaved, $this->_capture); + $this->_captureSaved[] = $this->_capture; return $this; } @@ -217,7 +217,7 @@ public function getOutput($clearPrevious = true) */ public function pushSilent() { - array_push($this->_silentSaved, $this->_silent); + $this->_silentSaved = $this->_silent; return $this; } diff --git a/downloader/lib/Mage/Connect/Package.php b/downloader/lib/Mage/Connect/Package.php index 818389181ea7e..f8033f71642c2 100644 --- a/downloader/lib/Mage/Connect/Package.php +++ b/downloader/lib/Mage/Connect/Package.php @@ -1391,7 +1391,7 @@ public function importDataV1x(array $data) $author['name'] = $authorRawData['name']; $author['user'] = $authorRawData['user']; $author['email'] = $authorRawData['email']; - array_push($authors, $author); + $authors[] = $author; } } } @@ -1420,7 +1420,7 @@ public function importDataV1x(array $data) $extension['name'] = $extensionRawData['name']; $extension['min_version'] = isset($extensionRawData['min']) ? $extensionRawData['min'] : null; $extension['max_version'] = isset($extensionRawData['max']) ? $extensionRawData['max'] : null; - array_push($extensions, $extension); + $extensions[] = $extension; } } // Handle packages @@ -1435,7 +1435,7 @@ public function importDataV1x(array $data) $package['channel'] = $this->convertChannelFromV1x($packageRawData['channel']); $package['min_version'] = isset($packageRawData['min']) ? $packageRawData['min'] : null; $package['max_version'] = isset($packageRawData['max']) ? $packageRawData['max'] : null; - array_push($packages, $package); + $packages[] = $package; } } } diff --git a/lib/Mage/Connect/Frontend.php b/lib/Mage/Connect/Frontend.php index a5c5e9aaa68d3..6ecdef216e313 100644 --- a/lib/Mage/Connect/Frontend.php +++ b/lib/Mage/Connect/Frontend.php @@ -120,7 +120,7 @@ public function doError($command, $message) */ public function pushCapture() { - array_push($this->_captureSaved, $this->_capture); + $this->_captureSaved[] = $this->_capture; return $this; } @@ -204,7 +204,7 @@ public function getOutput($clearPrevious = true) */ public function pushSilent() { - array_push($this->_silentSaved, $this->_silent); + $this->_silentSaved[] = $this->_silent; return $this; } diff --git a/lib/Magento/Di/Zend.php b/lib/Magento/Di/Zend.php index 159dc4bdd3a64..ccdf9437d8d9c 100644 --- a/lib/Magento/Di/Zend.php +++ b/lib/Magento/Di/Zend.php @@ -92,7 +92,7 @@ public function newInstance($name, array $parameters = array(), $isShared = true $definitions = $this->definitions; if (!$this->definitions()->hasClass($name)) { - array_push($this->instanceContext, array('NEW', $name, $name)); + $this->instanceContext[] = array('NEW', $name, $name); if ($this->_isArrayHasDataKey($parameters)) { $parameters = reset($parameters); @@ -141,7 +141,7 @@ public function newInstance($name, array $parameters = array(), $isShared = true $alias = null; } - array_push($this->instanceContext, array('NEW', $class, $alias)); + $this->instanceContext[] = array('NEW', $class, $alias); if (!$definitions->hasClass($class)) { $aliasMsg = ($alias) ? '(specified by alias ' . $alias . ') ' : ''; @@ -542,7 +542,7 @@ protected function resolveMethodParameters($class, $method, array $callTimeUserP "Circular dependency detected: $class depends on {$value[1]} and vice versa" ); } - array_push($this->currentDependencies, $class); + $this->currentDependencies[] = $class; $dConfig = $this->instanceManager->getConfig($computedParams['required'][$fqParamPos][0]); if ($dConfig['shared'] === false) { $resolvedParams[$index] diff --git a/lib/PEAR/PEAR.php b/lib/PEAR/PEAR.php index b4633bf3b8bd6..34fe0c80d827d 100644 --- a/lib/PEAR/PEAR.php +++ b/lib/PEAR/PEAR.php @@ -390,9 +390,9 @@ function setErrorHandling($mode = null, $options = null) function expectError($code = '*') { if (is_array($code)) { - array_push($this->_expected_errors, $code); + $this->_expected_errors[] = $code; } else { - array_push($this->_expected_errors, array($code)); + $this->_expected_errors[] = array($code); } return sizeof($this->_expected_errors); } diff --git a/lib/PEAR/PEAR/PEAR.php b/lib/PEAR/PEAR/PEAR.php index b4633bf3b8bd6..34fe0c80d827d 100644 --- a/lib/PEAR/PEAR/PEAR.php +++ b/lib/PEAR/PEAR/PEAR.php @@ -390,9 +390,9 @@ function setErrorHandling($mode = null, $options = null) function expectError($code = '*') { if (is_array($code)) { - array_push($this->_expected_errors, $code); + $this->_expected_errors[] = $code; } else { - array_push($this->_expected_errors, array($code)); + $this->_expected_errors[] = array($code); } return sizeof($this->_expected_errors); } diff --git a/lib/PEAR/XML/Parser/Simple.php b/lib/PEAR/XML/Parser/Simple.php index 2ba9fb513a02d..9f954cdcd94b5 100644 --- a/lib/PEAR/XML/Parser/Simple.php +++ b/lib/PEAR/XML/Parser/Simple.php @@ -220,10 +220,10 @@ function reset() */ function startHandler($xp, $elem, &$attribs) { - array_push($this->_elStack, array( + $this->_elStack[] = array( 'name' => $elem, 'attribs' => $attribs - )); + ); $this->_depth++; $this->_data[$this->_depth] = ''; } diff --git a/lib/PEAR/XML/Unserializer.php b/lib/PEAR/XML/Unserializer.php index 4db7e9f6edc72..18dd724911ef7 100644 --- a/lib/PEAR/XML/Unserializer.php +++ b/lib/PEAR/XML/Unserializer.php @@ -709,7 +709,7 @@ function startHandler($parser, $element, $attribs) $attribs[$this->options[XML_UNSERIALIZER_OPTION_ATTRIBUTE_CLASS]]; } - array_push($this->_valStack, $val); + $this->_valStack[] = $val; } /** @@ -903,17 +903,17 @@ function endHandler($parser, $element) } else { $parent['children'][$value['name']] = array(); } - array_push($parent['aggregKeys'], $value['name']); + $parent['aggregKeys'][] = $value['name']; } - array_push($parent['children'][$value['name']], $value['value']); + $parent['children'][$value['name']][] = $value['value']; } else { $parent['children'][$value['name']] = &$value['value']; - array_push($parent['childrenKeys'], $value['name']); + $parent['childrenKeys'][] = $value['name']; } } else { - array_push($parent['children'], $value['value']); + $parent['children'][] = $value['value']; } - array_push($this->_valStack, $parent); + $this->_valStack[] = $parent; } $this->_depth--; diff --git a/lib/Varien/Data/Tree/Node.php b/lib/Varien/Data/Tree/Node.php index 80405d3aed714..6894b4e258c2a 100644 --- a/lib/Varien/Data/Tree/Node.php +++ b/lib/Varien/Data/Tree/Node.php @@ -256,7 +256,7 @@ public function removeChild($childNode) public function getPath(&$prevNodes = array()) { if ($this->_parent) { - array_push($prevNodes, $this); + $prevNodes[] = $this; $this->_parent->getPath($prevNodes); } return $prevNodes; diff --git a/lib/Varien/Io/Abstract.php b/lib/Varien/Io/Abstract.php index fe20958538ddf..845d9bbcddc6d 100644 --- a/lib/Varien/Io/Abstract.php +++ b/lib/Varien/Io/Abstract.php @@ -105,7 +105,7 @@ public function getCleanPath($path) } } - array_push($realPathParts, $pathParts[$i]); + $realPathParts[] = $pathParts[$i]; } return $pathTokR . implode('/', $realPathParts); diff --git a/lib/Zend/Cloud/StorageService/Adapter/Nirvanix.php b/lib/Zend/Cloud/StorageService/Adapter/Nirvanix.php index 7909e9d07c675..0c606508ac363 100644 --- a/lib/Zend/Cloud/StorageService/Adapter/Nirvanix.php +++ b/lib/Zend/Cloud/StorageService/Adapter/Nirvanix.php @@ -319,12 +319,12 @@ private function getAllFolders($path, &$resultArray) //more than one, but doesn't return an array if there is only one. if ($numFolders == 1) { $folderPath = $response->ListFolder->Folder->Path; - array_push($resultArray, $folderPath); + $resultArray[] = $folderPath; $this->getAllFolders('/' . $folderPath, $resultArray); } else { foreach ($response->ListFolder->Folder as $arrayElem) { $folderPath = $arrayElem->Path; - array_push($resultArray, $folderPath); + $resultArray[] = $folderPath; $this->getAllFolders('/' . $folderPath, $resultArray); } } diff --git a/lib/Zend/Code/Reflection/MethodReflection.php b/lib/Zend/Code/Reflection/MethodReflection.php index 4199804ec86d2..7614657e7f315 100644 --- a/lib/Zend/Code/Reflection/MethodReflection.php +++ b/lib/Zend/Code/Reflection/MethodReflection.php @@ -150,7 +150,7 @@ public function getBody() $lastLine = array_pop($lines); if (trim($lastLine) !== '}') { - array_push($lines, $lastLine); + $lines[] = $lastLine; } // just in case we had code on the bracket lines diff --git a/lib/Zend/Code/Scanner/DocBlockScanner.php b/lib/Zend/Code/Scanner/DocBlockScanner.php index 677e4746a286f..f1d5a4aa9226a 100644 --- a/lib/Zend/Code/Scanner/DocBlockScanner.php +++ b/lib/Zend/Code/Scanner/DocBlockScanner.php @@ -137,8 +137,10 @@ protected function scan() goto SCANNER_CONTINUE; } case 'DOCBLOCK_TAG': - array_push($this->tags, array('name' => $token[1], - 'value' => '')); + $this->tags[] = array( + 'name' => $token[1], + 'value' => '' + ); end($this->tags); $tagIndex = key($this->tags); $mode = 3; diff --git a/lib/Zend/Controller/Plugin/ActionStack.php b/lib/Zend/Controller/Plugin/ActionStack.php index 3d6855d90c49b..c2d68697a7c63 100644 --- a/lib/Zend/Controller/Plugin/ActionStack.php +++ b/lib/Zend/Controller/Plugin/ActionStack.php @@ -189,7 +189,7 @@ protected function _saveStack(array $stack) public function pushStack(Zend_Controller_Request_Abstract $next) { $stack = $this->getStack(); - array_push($stack, $next); + $stack[] = $next; return $this->_saveStack($stack); } diff --git a/lib/Zend/Db/Select.php b/lib/Zend/Db/Select.php index 601259e9e2124..b5c107d7d9359 100644 --- a/lib/Zend/Db/Select.php +++ b/lib/Zend/Db/Select.php @@ -970,12 +970,12 @@ protected function _tableCols($correlationName, $cols, $afterCorrelationName = n // apply current values to current stack foreach ($columnValues as $columnValue) { - array_push($this->_parts[self::COLUMNS], $columnValue); + $this->_parts[self::COLUMNS][] = $columnValue; } // finish ensuring that all previous values are applied (if they exist) while ($tmpColumns) { - array_push($this->_parts[self::COLUMNS], array_shift($tmpColumns)); + $this->_parts[self::COLUMNS][] = array_shift($tmpColumns); } } } diff --git a/lib/Zend/Di/Di.php b/lib/Zend/Di/Di.php index 611543fb4e9d3..493b6a14b687c 100644 --- a/lib/Zend/Di/Di.php +++ b/lib/Zend/Di/Di.php @@ -132,7 +132,7 @@ public function instanceManager() */ public function get($name, array $params = array()) { - array_push($this->instanceContext, array('GET', $name, null)); + $this->instanceContext = array('GET', $name, null); $im = $this->instanceManager; @@ -183,7 +183,7 @@ public function newInstance($name, array $params = array(), $isShared = true) $alias = null; } - array_push($this->instanceContext, array('NEW', $class, $alias)); + $this->instanceContext[] = array('NEW', $class, $alias); if (!$definitions->hasClass($class)) { $aliasMsg = ($alias) ? '(specified by alias ' . $alias . ') ' : ''; @@ -663,7 +663,7 @@ protected function resolveMethodParameters($class, $method, array $callTimeUserP "Circular dependency detected: $class depends on {$value[1]} and viceversa" ); } - array_push($this->currentDependencies, $class); + $this->currentDependencies[] = $class; $dConfig = $this->instanceManager->getConfig($computedParams['required'][$fqParamPos][0]); if ($dConfig['shared'] === false) { $resolvedParams[$index] = $this->newInstance($computedParams['required'][$fqParamPos][0], $callTimeUserParams, false); diff --git a/lib/Zend/Filter/Compress/Zip.php b/lib/Zend/Filter/Compress/Zip.php index 3f1e19bc7d491..18244747b3a52 100644 --- a/lib/Zend/Filter/Compress/Zip.php +++ b/lib/Zend/Filter/Compress/Zip.php @@ -149,7 +149,7 @@ public function compress($content) } if (is_dir($current . $node)) { - array_push($stack, $current . $node . DIRECTORY_SEPARATOR); + $stack[] = $current . $node . DIRECTORY_SEPARATOR; } if (is_file($current . $node)) { diff --git a/lib/Zend/Filter/RealPath.php b/lib/Zend/Filter/RealPath.php index ebc5dc4ecacf9..f59c159eab54e 100644 --- a/lib/Zend/Filter/RealPath.php +++ b/lib/Zend/Filter/RealPath.php @@ -124,7 +124,7 @@ public function filter($value) if ($dir == '..') { array_pop($stack); } else { - array_push($stack, $dir); + $stack[] = $dir; } } } diff --git a/lib/Zend/Json/Server.php b/lib/Zend/Json/Server.php index c0ba372fab4ad..7d137e46af7c4 100644 --- a/lib/Zend/Json/Server.php +++ b/lib/Zend/Json/Server.php @@ -385,7 +385,7 @@ protected function _getDefaultParams(array $args, array $params) if (array_key_exists('default', $param)) { $value = $param['default']; } - array_push($args, $value); + $args[] = $value; } return $args; } @@ -425,7 +425,7 @@ protected function _getParams(Zend_Server_Method_Definition $method) } elseif (in_array($newType, $params[$key]['type'])) { continue; } - array_push($params[$key]['type'], $parameter->getType()); + $params[$key]['type'][] = $parameter->getType(); } } return $params; diff --git a/lib/Zend/Loader/Autoloader.php b/lib/Zend/Loader/Autoloader.php index ef71d65144378..f0a86815aac72 100644 --- a/lib/Zend/Loader/Autoloader.php +++ b/lib/Zend/Loader/Autoloader.php @@ -394,13 +394,13 @@ public function unshiftAutoloader($callback, $namespace = '') public function pushAutoloader($callback, $namespace = '') { $autoloaders = $this->getAutoloaders(); - array_push($autoloaders, $callback); + $autoloaders[] = $callback; $this->setAutoloaders($autoloaders); $namespace = (array) $namespace; foreach ($namespace as $ns) { $autoloaders = $this->getNamespaceAutoloaders($ns); - array_push($autoloaders, $callback); + $autoloaders[] = $callback; $this->_setNamespaceAutoloaders($autoloaders, $ns); } diff --git a/lib/Zend/Mail/Protocol/Imap.php b/lib/Zend/Mail/Protocol/Imap.php index 739aaa6b72eb5..a32f17bbbc1f4 100644 --- a/lib/Zend/Mail/Protocol/Imap.php +++ b/lib/Zend/Mail/Protocol/Imap.php @@ -204,7 +204,7 @@ protected function _decodeLine($line) while (($pos = strpos($line, ' ')) !== false) { $token = substr($line, 0, $pos); while ($token[0] == '(') { - array_push($stack, $tokens); + $stack[] = $tokens; $tokens = array(); $token = substr($token, 1); } diff --git a/lib/Zend/Mail/Storage/Folder/Maildir.php b/lib/Zend/Mail/Storage/Folder/Maildir.php index 1d4aa2127e23f..025ad4eafcae9 100644 --- a/lib/Zend/Mail/Storage/Folder/Maildir.php +++ b/lib/Zend/Mail/Storage/Folder/Maildir.php @@ -155,11 +155,11 @@ protected function _buildFolderTree() #require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception('error while reading maildir'); } - array_push($stack, $parent); + $stack[] = $parent; $parent = $dir . $this->_delim; $folder = new Zend_Mail_Storage_Folder($local, substr($dir, 1), true); $parentFolder->$local = $folder; - array_push($folderStack, $parentFolder); + $folderStack[] = $parentFolder; $parentFolder = $folder; break; } else if ($stack) { diff --git a/lib/Zend/Mail/Storage/Imap.php b/lib/Zend/Mail/Storage/Imap.php index 6cff487408911..613d7ba5c07bc 100644 --- a/lib/Zend/Mail/Storage/Imap.php +++ b/lib/Zend/Mail/Storage/Imap.php @@ -421,11 +421,11 @@ public function getFolders($rootFolder = null) } $selectable = !$data['flags'] || !in_array('\\Noselect', $data['flags']); - array_push($stack, $parent); + $stack[] = $parent; $parent = $globalName . $data['delim']; $folder = new Zend_Mail_Storage_Folder($localName, $globalName, $selectable); $parentFolder->$localName = $folder; - array_push($folderStack, $parentFolder); + $folderStack[] = $parentFolder; $parentFolder = $folder; break; } else if ($stack) { diff --git a/lib/Zend/Reflection/Method.php b/lib/Zend/Reflection/Method.php index ae4b3a8280991..632dff126ebe8 100644 --- a/lib/Zend/Reflection/Method.php +++ b/lib/Zend/Reflection/Method.php @@ -159,7 +159,7 @@ public function getBody() $lastLine = array_pop($lines); if (trim($lastLine) !== '}') { - array_push($lines, $lastLine); + $lines[] = $lastLine; } // just in case we had code on the bracket lines diff --git a/lib/Zend/Service/Amazon/Item.php b/lib/Zend/Service/Amazon/Item.php index 9968047ba5f44..bd81ca1d93fe3 100644 --- a/lib/Zend/Service/Amazon/Item.php +++ b/lib/Zend/Service/Amazon/Item.php @@ -148,7 +148,7 @@ public function __construct($dom) foreach ($result as $v) { if (isset($this->{$v->parentNode->tagName})) { if (is_array($this->{$v->parentNode->tagName})) { - array_push($this->{$v->parentNode->tagName}, (string) $v->data); + $this->{$v->parentNode->tagName}[] = (string) $v->data; } else { $this->{$v->parentNode->tagName} = array($this->{$v->parentNode->tagName}, (string) $v->data); } diff --git a/lib/Zend/Test/DbAdapter.php b/lib/Zend/Test/DbAdapter.php index 8f3856da85754..773f0f99ddaa9 100644 --- a/lib/Zend/Test/DbAdapter.php +++ b/lib/Zend/Test/DbAdapter.php @@ -94,7 +94,7 @@ public function __construct() */ public function appendStatementToStack(Zend_Test_DbStatement $stmt) { - array_push($this->_statementStack, $stmt); + $this->_statementStack[] = $stmt; return $this; } @@ -106,7 +106,7 @@ public function appendStatementToStack(Zend_Test_DbStatement $stmt) */ public function appendLastInsertIdToStack($id) { - array_push($this->_lastInsertIdStack, $id); + $this->_lastInsertIdStack[] = $id; return $this; } diff --git a/lib/Zend/Tool/Framework/Client/Console.php b/lib/Zend/Tool/Framework/Client/Console.php index 1db3248fd653d..d6e52558820b7 100644 --- a/lib/Zend/Tool/Framework/Client/Console.php +++ b/lib/Zend/Tool/Framework/Client/Console.php @@ -160,7 +160,7 @@ protected function _preInit() // add classes to the basic loader from the config file basicloader.classes.1 .. if (isset($config->basicloader) && isset($config->basicloader->classes)) { foreach ($config->basicloader->classes as $classKey => $className) { - array_push($classesToLoad, $className); + $classesToLoad[] = $className; } } diff --git a/lib/Zend/Tool/Framework/Client/Console/ArgumentParser.php b/lib/Zend/Tool/Framework/Client/Console/ArgumentParser.php index 56aea30191a0d..852a96b45b0eb 100644 --- a/lib/Zend/Tool/Framework/Client/Console/ArgumentParser.php +++ b/lib/Zend/Tool/Framework/Client/Console/ArgumentParser.php @@ -471,7 +471,7 @@ protected function _parseProviderOptionsPart() $wordStack = array(); while (($wordOnTop = array_shift($this->_argumentsWorking))) { if (substr($wordOnTop, 0, 1) != '-') { - array_push($wordStack, $wordOnTop); + $wordStack[] = $wordOnTop; } else { // put word back on stack and move on array_unshift($this->_argumentsWorking, $wordOnTop); diff --git a/lib/Zend/Tool/Project/Context/Zf/ApplicationConfigFile.php b/lib/Zend/Tool/Project/Context/Zf/ApplicationConfigFile.php index cb9c194b7b328..61e6349c79789 100644 --- a/lib/Zend/Tool/Project/Context/Zf/ApplicationConfigFile.php +++ b/lib/Zend/Tool/Project/Context/Zf/ApplicationConfigFile.php @@ -176,7 +176,7 @@ public function addItem($item, $section = 'production', $quoteValue = true) $lastDepth = $rii->getDepth(); if (is_array($value)) { - array_push($configKeyNames, $name); + $configKeyNames[] = $name; } else { $stringItems[] = implode('.', $configKeyNames) . '.' . $name; $stringValues[] = $value; @@ -236,7 +236,7 @@ public function removeItem($item, $section = 'production') $lastDepth = $rii->getDepth(); if (is_array($value)) { - array_push($configKeyNames, $name); + $configKeyNames[] = $name; } else { $stringItems[] = implode('.', $configKeyNames) . '.' . $name; $stringValues[] = $value; diff --git a/lib/Zend/Tool/Project/Profile/Resource/Container.php b/lib/Zend/Tool/Project/Profile/Resource/Container.php index 3bad6914b3330..2f7b9526769bb 100644 --- a/lib/Zend/Tool/Project/Profile/Resource/Container.php +++ b/lib/Zend/Tool/Project/Profile/Resource/Container.php @@ -320,7 +320,7 @@ public function append(Zend_Tool_Project_Profile_Resource_Container $resource) if (!$this->isAppendable()) { throw new Exception('Resource by name ' . (string) $this . ' is not appendable'); } - array_push($this->_subResources, $resource); + $this->_subResources[] = $resource; $resource->setParentResource($this); return $this; diff --git a/lib/Zend/Tool/Project/Profile/Resource/SearchConstraints.php b/lib/Zend/Tool/Project/Profile/Resource/SearchConstraints.php index f087d5df6f54d..d337f7cf133a6 100644 --- a/lib/Zend/Tool/Project/Profile/Resource/SearchConstraints.php +++ b/lib/Zend/Tool/Project/Profile/Resource/SearchConstraints.php @@ -87,7 +87,7 @@ public function addConstraint($constraint) $constraint = $this->_makeConstraint($name, $params); - array_push($this->_constraints, $constraint); + $this->_constraints[] = $constraint; return $this; } diff --git a/lib/Zend/Tool/Project/Provider/Module.php b/lib/Zend/Tool/Project/Provider/Module.php index 6220d2db51fcd..74f3f16dc6144 100644 --- a/lib/Zend/Tool/Project/Provider/Module.php +++ b/lib/Zend/Tool/Project/Provider/Module.php @@ -99,7 +99,7 @@ public static function createResources(Zend_Tool_Project_Profile $profile, $modu if ($depthDifference === 1) { // if we went down into a child, make note - array_push($parentResources, $currentResource); + $parentResources[] = $currentResource; // this will have always been set previously by another loop $currentResource = $currentChildResource; } elseif ($depthDifference < 0) { diff --git a/lib/Zend/Wildfire/Plugin/FirePhp.php b/lib/Zend/Wildfire/Plugin/FirePhp.php index 3b5ab139777b3..6f318e8bae993 100644 --- a/lib/Zend/Wildfire/Plugin/FirePhp.php +++ b/lib/Zend/Wildfire/Plugin/FirePhp.php @@ -668,7 +668,7 @@ protected function _encodeObject($object, $objectDepth = 1, $arrayDepth = 1) return '** Recursion ('.get_class($object).') **'; } } - array_push($this->_objectStack, $object); + $this->_objectStack[] = $object; $return['__className'] = $class = get_class($object); From e702d143ef57a33dfe57c1d7b6a3ad50f3455c46 Mon Sep 17 00:00:00 2001 From: Anders Persson Date: Tue, 29 Jan 2013 10:58:10 +0100 Subject: [PATCH 2/4] typo --- lib/Mage/Connect/Frontend.php | 1 - lib/Zend/Di/Di.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/Mage/Connect/Frontend.php b/lib/Mage/Connect/Frontend.php index 6ecdef216e313..a0cb440716bd3 100644 --- a/lib/Mage/Connect/Frontend.php +++ b/lib/Mage/Connect/Frontend.php @@ -23,7 +23,6 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - class Mage_Connect_Frontend { diff --git a/lib/Zend/Di/Di.php b/lib/Zend/Di/Di.php index 493b6a14b687c..6667a12c0a05c 100644 --- a/lib/Zend/Di/Di.php +++ b/lib/Zend/Di/Di.php @@ -132,7 +132,7 @@ public function instanceManager() */ public function get($name, array $params = array()) { - $this->instanceContext = array('GET', $name, null); + $this->instanceContext[] = array('GET', $name, null); $im = $this->instanceManager; From f54b933b7c8039d23aef5ca0114e79f4eeec569b Mon Sep 17 00:00:00 2001 From: Anders Persson Date: Tue, 5 Feb 2013 17:56:28 +0100 Subject: [PATCH 3/4] fixed missing [] --- downloader/lib/Mage/Connect/Frontend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downloader/lib/Mage/Connect/Frontend.php b/downloader/lib/Mage/Connect/Frontend.php index 2492284110483..6912e1a530815 100644 --- a/downloader/lib/Mage/Connect/Frontend.php +++ b/downloader/lib/Mage/Connect/Frontend.php @@ -217,7 +217,7 @@ public function getOutput($clearPrevious = true) */ public function pushSilent() { - $this->_silentSaved = $this->_silent; + $this->_silentSaved[] = $this->_silent; return $this; } From 8994b145e21af9d7c0cc0fee199dce7360fb6747 Mon Sep 17 00:00:00 2001 From: Anders Persson Date: Tue, 5 Feb 2013 17:57:27 +0100 Subject: [PATCH 4/4] Fixed tabs into spaces --- lib/Zend/Code/Scanner/DocBlockScanner.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Zend/Code/Scanner/DocBlockScanner.php b/lib/Zend/Code/Scanner/DocBlockScanner.php index f1d5a4aa9226a..22749940232bb 100644 --- a/lib/Zend/Code/Scanner/DocBlockScanner.php +++ b/lib/Zend/Code/Scanner/DocBlockScanner.php @@ -140,7 +140,7 @@ protected function scan() $this->tags[] = array( 'name' => $token[1], 'value' => '' - ); + ); end($this->tags); $tagIndex = key($this->tags); $mode = 3;