Skip to content

Commit 95b1727

Browse files
build(deps-dev): bump phpstan/phpstan from 2.2.1 to 2.2.2 (#5640)
* build(deps-dev): bump phpstan/phpstan from 2.2.1 to 2.2.2 --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-version: 2.2.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Update Import.php * ~ phpstan * Update Uploader pathinfo * phpstan null === null * Fulltext: getSearchType * ~ phpstan * ~ phpstan:baseline --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Hans Mackowiak <h.mackowiak@b3-it.de>
1 parent 4cc29a4 commit 95b1727

9 files changed

Lines changed: 31 additions & 65 deletions

File tree

.phpstan.dist.baselines/equal.notAllowed.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,21 +2061,6 @@
20612061
'count' => 1,
20622062
'path' => __DIR__ . '/../app/code/core/Mage/CatalogSearch/Model/Resource/Advanced.php',
20632063
];
2064-
$ignoreErrors[] = [
2065-
'rawMessage' => 'Loose comparison via "==" between int and int is not allowed.',
2066-
'count' => 4,
2067-
'path' => __DIR__ . '/../app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php',
2068-
];
2069-
$ignoreErrors[] = [
2070-
'rawMessage' => 'Loose comparison via "==" between int<min, 0>|int<2, max> and int is not allowed.',
2071-
'count' => 1,
2072-
'path' => __DIR__ . '/../app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php',
2073-
];
2074-
$ignoreErrors[] = [
2075-
'rawMessage' => 'Loose comparison via "==" between int<min, 1>|int<3, max> and int is not allowed.',
2076-
'count' => 1,
2077-
'path' => __DIR__ . '/../app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php',
2078-
];
20792064
$ignoreErrors[] = [
20802065
'rawMessage' => 'Loose comparison via "==" between mixed and string is not allowed.',
20812066
'count' => 2,
@@ -2303,7 +2288,12 @@
23032288
];
23042289
$ignoreErrors[] = [
23052290
'rawMessage' => 'Loose comparison via "==" between mixed and mixed is not allowed.',
2306-
'count' => 2,
2291+
'count' => 1,
2292+
'path' => __DIR__ . '/../app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php',
2293+
];
2294+
$ignoreErrors[] = [
2295+
'rawMessage' => 'Loose comparison via "==" between mixed and string is not allowed.',
2296+
'count' => 1,
23072297
'path' => __DIR__ . '/../app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php',
23082298
];
23092299
$ignoreErrors[] = [

.phpstan.dist.baselines/notEqual.notAllowed.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3012,13 +3012,13 @@
30123012
'path' => __DIR__ . '/../lib/Varien/Db/Adapter/Pdo/Mysql.php',
30133013
];
30143014
$ignoreErrors[] = [
3015-
'rawMessage' => 'Loose comparison via "!=" between mixed and int is not allowed.',
3016-
'count' => 3,
3015+
'rawMessage' => 'Loose comparison via "!=" between *NEVER* and *NEVER* is not allowed.',
3016+
'count' => 1,
30173017
'path' => __DIR__ . '/../lib/Varien/Db/Tree.php',
30183018
];
30193019
$ignoreErrors[] = [
3020-
'rawMessage' => 'Loose comparison via "!=" between mixed and mixed is not allowed.',
3021-
'count' => 1,
3020+
'rawMessage' => 'Loose comparison via "!=" between mixed and int is not allowed.',
3021+
'count' => 3,
30223022
'path' => __DIR__ . '/../lib/Varien/Db/Tree.php',
30233023
];
30243024
$ignoreErrors[] = [

.phpstan.dist.baselines/offsetAccess.notFound.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -181,21 +181,6 @@
181181
'count' => 1,
182182
'path' => __DIR__ . '/../app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php',
183183
];
184-
$ignoreErrors[] = [
185-
'rawMessage' => 'Offset 1 might not exist on array{}|array{0: non-empty-string, 1: string, 2: numeric-string, 3?: string}.',
186-
'count' => 1,
187-
'path' => __DIR__ . '/../app/code/core/Mage/ImportExport/Model/Import.php',
188-
];
189-
$ignoreErrors[] = [
190-
'rawMessage' => 'Offset 2 might not exist on array{}|array{0: non-empty-string, 1: string, 2: numeric-string, 3?: string}.',
191-
'count' => 1,
192-
'path' => __DIR__ . '/../app/code/core/Mage/ImportExport/Model/Import.php',
193-
];
194-
$ignoreErrors[] = [
195-
'rawMessage' => 'Offset 3 might not exist on array{}|array{0: non-empty-string, 1: string, 2: numeric-string, 3?: string}.',
196-
'count' => 1,
197-
'path' => __DIR__ . '/../app/code/core/Mage/ImportExport/Model/Import.php',
198-
];
199184
$ignoreErrors[] = [
200185
'rawMessage' => 'Offset \'extension\' might not exist on array{dirname?: string, basename: string, extension?: string, filename: string}.',
201186
'count' => 1,
@@ -236,16 +221,6 @@
236221
'count' => 1,
237222
'path' => __DIR__ . '/../lib/Mage/System/Ftp.php',
238223
];
239-
$ignoreErrors[] = [
240-
'rawMessage' => 'Offset \'dirname\' might not exist on array{dirname?: string, basename: string, extension?: string, filename: string}.',
241-
'count' => 1,
242-
'path' => __DIR__ . '/../lib/Varien/File/Uploader.php',
243-
];
244-
$ignoreErrors[] = [
245-
'rawMessage' => 'Offset \'extension\' might not exist on array{dirname?: string, basename: string, extension?: string, filename: string}.',
246-
'count' => 3,
247-
'path' => __DIR__ . '/../lib/Varien/File/Uploader.php',
248-
];
249224
$ignoreErrors[] = [
250225
'rawMessage' => 'Offset \'dirname\' might not exist on array{dirname?: string, basename: string, extension?: string, filename: string}.',
251226
'count' => 1,

app/code/core/Mage/CatalogSearch/Model/Fulltext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function prepareResult($query = null)
138138
*/
139139
public function getSearchType($storeId = null)
140140
{
141-
return Mage::getStoreConfig(self::XML_PATH_CATALOG_SEARCH_TYPE, $storeId);
141+
return Mage::getStoreConfigAsInt(self::XML_PATH_CATALOG_SEARCH_TYPE, $storeId);
142142
}
143143

144144
// Deprecated methods

app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ public function prepareResult($object, $queryText, $query)
334334
$bind = [];
335335
$like = [];
336336
$likeCond = '';
337-
if ($searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE
338-
|| $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE
337+
if ($searchType === Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE
338+
|| $searchType === Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE
339339
) {
340340
$helper = Mage::getResourceHelper('core');
341341
$words = Mage::helper('core/string')->splitWords($queryText, true, $query->getMaxQueryWords());
@@ -362,16 +362,16 @@ public function prepareResult($object, $queryText, $query)
362362
->where($mainTableAlias . '.store_id = ?', (int) $query->getStoreId());
363363

364364
$where = '';
365-
if ($searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_FULLTEXT
366-
|| $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE
365+
if ($searchType === Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_FULLTEXT
366+
|| $searchType === Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE
367367
) {
368368
$bind[':query'] = implode(' ', $preparedTerms[0]);
369369
$where = $searchHelper->chooseFulltext($this->getMainTable(), $mainTableAlias, $select);
370370
}
371371

372-
if ($likeCond !== '' && $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE) {
372+
if ($likeCond !== '' && $searchType === Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE) {
373373
$where .= ($where ? ' OR ' : '') . $likeCond;
374-
} elseif ($likeCond !== '' && $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE) {
374+
} elseif ($likeCond !== '' && $searchType === Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE) {
375375
$select->columns(['relevance' => new Zend_Db_Expr('0')]);
376376
$where = $likeCond;
377377
}

app/code/core/Mage/Eav/Model/Entity/Abstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,7 @@ public function saveAttribute(Varien_Object $object, $attributeCode)
16031603
$this->_insertAttribute($object, $attribute, $newValue);
16041604
} elseif ($origValueId !== false && ($newValue !== null)) {
16051605
$this->_updateAttribute($object, $attribute, $origValueId, $newValue);
1606-
} elseif ($origValueId !== false && ($newValue === null)) {
1606+
} elseif ($origValueId !== false) {
16071607
$adapter->delete($table, $where);
16081608
}
16091609

app/code/core/Mage/ImportExport/Model/Import.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,8 @@ public function expandSource()
369369
$adapter = $this->_getSourceAdapter(self::getWorkingDir() . sprintf($filenameFormat, $i - 1));
370370
foreach ($adapter as $row) {
371371
foreach ($colReg as $colName => $regExpType) {
372-
if (!empty($row[$colName])) {
373-
preg_match($regExps[$regExpType], $row[$colName], $matches);
374-
375-
$row[$colName] = $matches[1] . ((int) $matches[2] + $size) . ($regExpType === 'middle' ? $matches[3] : '');
372+
if (!empty($row[$colName]) && preg_match($regExps[$regExpType], $row[$colName], $matches) !== false && ($matches) !== []) {
373+
$row[$colName] = $matches[1] . ((int) $matches[2] + $size) . ($matches[3] ?? '');
376374
}
377375
}
378376

composer.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Varien/File/Uploader.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ public static function getCorrectFileName($fileName)
336336
$fileInfo = pathinfo($fileName);
337337

338338
if (preg_match('/^_+$/', $fileInfo['filename'])) {
339-
return 'file.' . $fileInfo['extension'];
339+
$ext = isset($fileInfo['extension']) ? '.' . $fileInfo['extension'] : '';
340+
return 'file' . $ext;
340341
}
341342

342343
return $fileName;
@@ -557,9 +558,11 @@ public static function getNewFileName($destFile)
557558
$fileInfo = pathinfo($destFile);
558559
if (file_exists($destFile)) {
559560
$index = 1;
560-
$baseName = $fileInfo['filename'] . '.' . $fileInfo['extension'];
561-
while (file_exists($fileInfo['dirname'] . DIRECTORY_SEPARATOR . $baseName)) {
562-
$baseName = $fileInfo['filename'] . '_' . $index . '.' . $fileInfo['extension'];
561+
$ext = isset($fileInfo['extension']) ? '.' . $fileInfo['extension'] : '';
562+
$baseName = $fileInfo['filename'] . $ext;
563+
$dirName = isset($fileInfo['dirname']) ? $fileInfo['dirname'] . DIRECTORY_SEPARATOR : '';
564+
while (file_exists($dirName . $baseName)) {
565+
$baseName = $fileInfo['filename'] . '_' . $index . $ext;
563566
$index++;
564567
}
565568

0 commit comments

Comments
 (0)