diff --git a/app/code/core/Mage/Adminhtml/Model/Config/Data.php b/app/code/core/Mage/Adminhtml/Model/Config/Data.php index add8890fd4c..9df3c531950 100644 --- a/app/code/core/Mage/Adminhtml/Model/Config/Data.php +++ b/app/code/core/Mage/Adminhtml/Model/Config/Data.php @@ -357,6 +357,7 @@ protected function _getPathConfig($path, $full = true) * @param string $path * @param null|bool $inherit * @param null|array $configData + * @param-out bool $inherit * @return Varien_Simplexml_Element */ public function getConfigDataValue($path, &$inherit = null, $configData = null) diff --git a/app/code/core/Mage/Api/Helper/Data.php b/app/code/core/Mage/Api/Helper/Data.php index c216a164058..4616a2e6e1e 100644 --- a/app/code/core/Mage/Api/Helper/Data.php +++ b/app/code/core/Mage/Api/Helper/Data.php @@ -223,7 +223,8 @@ public function packArrayToObject(array $arr) /** * Convert objects and arrays to array recursively * - * @param array|object $data + * @param array|object $data + * @param-out array $data */ public function toArray(&$data) { @@ -323,6 +324,7 @@ protected function _parseComplexFilter($complexFilter) * * @param string $conditionOperator * @param string $conditionValue + * @param-out string|array $conditionValue */ public function formatFilterConditionValue($conditionOperator, &$conditionValue) { diff --git a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php index 5ad0ad18ad8..0c778fd5066 100644 --- a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php +++ b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php @@ -270,11 +270,14 @@ public function call($sessionId, $apiPath, $args = []) } $methodInfo = $resources->$resourceName->methods->$methodName; + $method = (isset($methodInfo->method) ? (string) $methodInfo->method : $methodName); - try { - $method = (isset($methodInfo->method) ? (string) $methodInfo->method : $methodName); + if (!isset($resources->$resourceName->model)) { + throw new Mage_Api_Exception('resource_path_not_callable'); + } - $modelName = $this->_prepareResourceModelName((string) $resources->$resourceName->model); + try { + $modelName = $this->_prepareResourceModelName((string)$resources->$resourceName->model); try { $model = Mage::getModel($modelName); if ($model instanceof Mage_Api_Model_Resource_Abstract) { @@ -391,11 +394,15 @@ public function multiCall($sessionId, array $calls = [], $options = []) } $methodInfo = $resources->$resourceName->methods->$methodName; + $method = (isset($methodInfo->method) ? (string) $methodInfo->method : $methodName); - try { - $method = (isset($methodInfo->method) ? (string) $methodInfo->method : $methodName); + if (!isset($resources->$resourceName->model)) { + throw new Mage_Api_Exception('resource_path_not_callable'); + } + try { $modelName = $this->_prepareResourceModelName((string) $resources->$resourceName->model); + try { $model = Mage::getModel($modelName); } catch (Exception $e) { diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php index fece8550ae6..2a2995f27c7 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php @@ -45,7 +45,7 @@ public function prepareTierPrices($product, $tierPrices = null) } if (!isset($tierPrice->website) || $tierPrice->website == 'all') { - $tierPrice->website = 0; + $tierPrice->website = 0; // @phpstan-ignore-line } else { try { $tierPrice->website = Mage::app()->getWebsite($tierPrice->website)->getId(); @@ -59,7 +59,7 @@ public function prepareTierPrices($product, $tierPrices = null) } if (!isset($tierPrice->customer_group_id)) { - $tierPrice->customer_group_id = 'all'; + $tierPrice->customer_group_id = 'all'; // @phpstan-ignore-line } if ($tierPrice->customer_group_id == 'all') { diff --git a/app/code/core/Mage/CatalogSearch/Block/Term.php b/app/code/core/Mage/CatalogSearch/Block/Term.php index 9606a6cf0ea..10503bc18ab 100644 --- a/app/code/core/Mage/CatalogSearch/Block/Term.php +++ b/app/code/core/Mage/CatalogSearch/Block/Term.php @@ -60,10 +60,12 @@ protected function _loadTerms() $temp[$term->getName()] = $term; $termKeys[] = $term->getName(); } - natcasesort($termKeys); - foreach ($termKeys as $termKey) { - $this->_terms[$termKey] = $temp[$termKey]; + if (isset($termKeys)) { + natcasesort($termKeys); + foreach ($termKeys as $termKey) { + $this->_terms[$termKey] = $temp[$termKey]; + } } } return $this; diff --git a/app/code/core/Mage/Core/Model/Input/Filter.php b/app/code/core/Mage/Core/Model/Input/Filter.php index afcdbe395d3..0fa3e22411b 100644 --- a/app/code/core/Mage/Core/Model/Input/Filter.php +++ b/app/code/core/Mage/Core/Model/Input/Filter.php @@ -204,6 +204,7 @@ public function filter($data) * @param array $data * @param array|null $filters * @param bool $isFilterListSimple + * @param-out array $filters * @return array * @throws Exception Exception when filter is not found or not instance of defined instances */ diff --git a/app/code/core/Mage/Core/Model/Translate/Inline.php b/app/code/core/Mage/Core/Model/Translate/Inline.php index cc9202d18fa..c1c080239f7 100644 --- a/app/code/core/Mage/Core/Model/Translate/Inline.php +++ b/app/code/core/Mage/Core/Model/Translate/Inline.php @@ -182,6 +182,7 @@ public function processAjaxPost($translate) * Strip inline translations from text * * @param array|string $body + * @param-out array|string|null $body * @return $this */ public function stripInlineTranslations(&$body) @@ -200,6 +201,7 @@ public function stripInlineTranslations(&$body) * Replace translate templates to HTML fragments * * @param array|string $body + * @param-out array|string|null $body * @return $this */ public function processResponseBody(&$body) diff --git a/app/code/core/Mage/Downloadable/Model/Link/Api/V2.php b/app/code/core/Mage/Downloadable/Model/Link/Api/V2.php index 5781ecdbe0d..dde76835853 100644 --- a/app/code/core/Mage/Downloadable/Model/Link/Api/V2.php +++ b/app/code/core/Mage/Downloadable/Model/Link/Api/V2.php @@ -25,6 +25,7 @@ class Mage_Downloadable_Model_Link_Api_V2 extends Mage_Downloadable_Model_Link_A * Clean the object, leave only property values * * @param object $var + * @param-out array $var */ protected function _prepareData(&$var) { diff --git a/app/code/core/Mage/Downloadable/Model/Link/Api/Validator.php b/app/code/core/Mage/Downloadable/Model/Link/Api/Validator.php index 09df3fd53a8..9e7cfae71bd 100644 --- a/app/code/core/Mage/Downloadable/Model/Link/Api/Validator.php +++ b/app/code/core/Mage/Downloadable/Model/Link/Api/Validator.php @@ -208,6 +208,7 @@ public function validateNumOfDownloads(&$var) * Validate variable, in case of fault loads default entity. * * @param int|bool $var + * @param-out int $var */ public function validateUnlimited(&$var) { diff --git a/app/code/core/Mage/Paypal/Model/Api/Standard.php b/app/code/core/Mage/Paypal/Model/Api/Standard.php index ea5a0dd5429..a557e757e0d 100644 --- a/app/code/core/Mage/Paypal/Model/Api/Standard.php +++ b/app/code/core/Mage/Paypal/Model/Api/Standard.php @@ -196,7 +196,7 @@ protected function _exportLineItems(array &$request, $i = 1) /** * Import address object, if set, to the request * - * @param array $request + * @param array|Varien_Object $request */ protected function _importAddress(&$request) { diff --git a/app/code/core/Mage/Sales/Model/Order/Payment/Transaction.php b/app/code/core/Mage/Sales/Model/Order/Payment/Transaction.php index 6aab8828d3c..7457514faea 100644 --- a/app/code/core/Mage/Sales/Model/Order/Payment/Transaction.php +++ b/app/code/core/Mage/Sales/Model/Order/Payment/Transaction.php @@ -675,13 +675,11 @@ protected function _loadChildren() $child->setOrderPaymentObject($payment); } $this->_children[$child->getId()] = $child; - if ($this->_identifiedChildren !== false) { - $childTxnId = $child->getTxnId(); - if (!$childTxnId || $childTxnId == '0') { - $this->_identifiedChildren = false; - } else { - $this->_identifiedChildren[$child->getTxnId()] = $child; - } + $childTxnId = $child->getTxnId(); + if (!$childTxnId || $childTxnId == '0') { + $this->_identifiedChildren = false; + } else { + $this->_identifiedChildren[$child->getTxnId()] = $child; } } if ($this->_identifiedChildren === false) { diff --git a/composer.lock b/composer.lock index a4d6ca0664e..1b12545d35f 100644 --- a/composer.lock +++ b/composer.lock @@ -3227,16 +3227,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.59", + "version": "1.10.66", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e607609388d3a6d418a50a49f7940e8086798281" + "reference": "94779c987e4ebd620025d9e5fdd23323903950bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e607609388d3a6d418a50a49f7940e8086798281", - "reference": "e607609388d3a6d418a50a49f7940e8086798281", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/94779c987e4ebd620025d9e5fdd23323903950bd", + "reference": "94779c987e4ebd620025d9e5fdd23323903950bd", "shasum": "" }, "require": { @@ -3285,7 +3285,7 @@ "type": "tidelift" } ], - "time": "2024-02-20T13:59:13+00:00" + "time": "2024-03-28T16:17:31+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/lib/Varien/Db/Adapter/Pdo/Mysql.php b/lib/Varien/Db/Adapter/Pdo/Mysql.php index 17f3637ebb5..c169ae603a2 100644 --- a/lib/Varien/Db/Adapter/Pdo/Mysql.php +++ b/lib/Varien/Db/Adapter/Pdo/Mysql.php @@ -511,6 +511,7 @@ public function query($sql, $bind = []) * with named binds. * * @param Zend_Db_Select|string $sql + * @param-out string $sql * @param mixed $bind * @return $this */ diff --git a/phpstan.dist.baseline.neon b/phpstan.dist.baseline.neon index ca92edf5f60..e24f6f3f8b7 100644 --- a/phpstan.dist.baseline.neon +++ b/phpstan.dist.baseline.neon @@ -740,11 +740,6 @@ parameters: count: 1 path: app/code/core/Mage/Api/Model/Server/Adapter/Soap.php - - - message: "#^Access to an undefined property object\\:\\:\\$model\\.$#" - count: 2 - path: app/code/core/Mage/Api/Model/Server/Handler/Abstract.php - - message: "#^Result of method SoapServer\\:\\:handle\\(\\) \\(void\\) is used\\.$#" count: 1 @@ -1560,16 +1555,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api/V2.php - - - message: "#^Access to an undefined property object\\:\\:\\$customer_group_id\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php - - - - message: "#^Access to an undefined property object\\:\\:\\$website\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php - - message: "#^Method Mage_Catalog_Model_Resource_Product_Compare_Item\\:\\:clean\\(\\) invoked with 1 parameter, 0 required\\.$#" count: 1 @@ -2035,11 +2020,6 @@ parameters: count: 1 path: app/code/core/Mage/CatalogSearch/Block/Term.php - - - message: "#^Variable \\$termKeys might not be defined\\.$#" - count: 2 - path: app/code/core/Mage/CatalogSearch/Block/Term.php - - message: "#^Property Mage_CatalogSearch_Helper_Data\\:\\:\\$_queryText \\(string\\) in isset\\(\\) is not nullable\\.$#" count: 1