Skip to content

Commit 84e999f

Browse files
authored
1 parent 034f2ae commit 84e999f

File tree

9 files changed

+12
-13
lines changed

9 files changed

+12
-13
lines changed

.rector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
CodeQuality\If_\SimplifyIfReturnBoolRector::class,
6565
CodeQuality\Include_\AbsolutizeRequireAndIncludePathRector::class, # todo: TMP
6666
CodeQuality\Isset_\IssetOnPropertyObjectToPropertyExistsRector::class, # todo: TMP
67-
CodeQuality\Ternary\NumberCompareToMaxFuncCallRector::class, # todo: TMP
6867
CodeQuality\Ternary\SwitchNegatedTernaryRector::class, # todo: TMP
6968
CodeQuality\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector::class, # todo: TMP
7069
CodeQuality\Ternary\UnnecessaryTernaryExpressionRector::class, # todo: TMP

app/code/core/Mage/Admin/Model/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,6 @@ public function getMinAdminPasswordLength()
790790
{
791791
$minLength = Mage::getStoreConfigAsInt(self::XML_PATH_MIN_ADMIN_PASSWORD_LENGTH);
792792
$absoluteMinLength = Mage_Core_Model_App::ABSOLUTE_MIN_PASSWORD_LENGTH;
793-
return ($minLength < $absoluteMinLength) ? $absoluteMinLength : $minLength;
793+
return max($absoluteMinLength, $minLength);
794794
}
795795
}

app/code/core/Mage/Core/Model/File/Storage/Database.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ public function importDirectories($dirs)
160160
*/
161161
public function exportFiles($offset = 0, $count = 100)
162162
{
163-
$offset = ((int) $offset >= 0) ? (int) $offset : 0;
164-
$count = ((int) $count >= 1) ? (int) $count : 1;
163+
$offset = max((int) $offset, 0);
164+
$count = max((int) $count, 1);
165165

166166
$result = $this->_getResource()->getFiles($offset, $count);
167167
if (empty($result)) {

app/code/core/Mage/Core/Model/File/Storage/Directory/Database.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ public function createRecursive($path)
144144
*/
145145
public function exportDirectories($offset = 0, $count = 100)
146146
{
147-
$offset = ((int) $offset >= 0) ? (int) $offset : 0;
148-
$count = ((int) $count >= 1) ? (int) $count : 1;
147+
$offset = max((int) $offset, 0);
148+
$count = max((int) $count, 1);
149149

150150
$result = $this->_getResource()->exportDirectories($offset, $count);
151151

app/code/core/Mage/Core/Model/File/Storage/File.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ public function collectData($offset = 0, $count = 100, $type = 'files')
111111
return false;
112112
}
113113

114-
$offset = ((int) $offset >= 0) ? (int) $offset : 0;
115-
$count = ((int) $count >= 1) ? (int) $count : 1;
114+
$offset = max((int) $offset, 0);
115+
$count = max((int) $count, 1);
116116

117117
if (is_null($this->_data)) {
118118
$this->_data = $this->getStorageData();

app/code/core/Mage/Customer/Model/Customer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,6 @@ public function getMinPasswordLength()
16601660
{
16611661
$minLength = Mage::getStoreConfigAsInt(self::XML_PATH_MIN_PASSWORD_LENGTH);
16621662
$absoluteMinLength = Mage_Core_Model_App::ABSOLUTE_MIN_PASSWORD_LENGTH;
1663-
return ($minLength < $absoluteMinLength) ? $absoluteMinLength : $minLength;
1663+
return max($absoluteMinLength, $minLength);
16641664
}
16651665
}

app/code/core/Mage/ImportExport/Block/Adminhtml/Export/Filter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ protected function _getMultiSelectHtml(Mage_Eav_Model_Entity_Attribute $attribut
104104
'name' => $this->getFilterElementName($attribute->getAttributeCode()) . '[]',
105105
'id' => $this->getFilterElementId($attribute->getAttributeCode()),
106106
'class' => 'multiselect',
107-
'extra_params' => 'multiple="multiple" size="' . ($size > 5 ? 5 : ($size < 2 ? 2 : $size))
107+
'extra_params' => 'multiple="multiple" size="' . ($size > 5 ? 5 : (max(2, $size)))
108108
. '" style="width:280px"',
109109
]);
110110
return $selectBlock->setOptions($options)->getHtml();
@@ -237,7 +237,7 @@ protected function _getMultiSelectHtmlWithValue(Mage_Eav_Model_Entity_Attribute
237237
'name' => $this->getFilterElementName($attribute->getAttributeCode()) . '[]',
238238
'id' => $this->getFilterElementId($attribute->getAttributeCode()),
239239
'class' => 'multiselect multiselect-export-filter',
240-
'extra_params' => 'multiple="multiple" size="' . ($size > 5 ? 5 : ($size < 2 ? 2 : $size)),
240+
'extra_params' => 'multiple="multiple" size="' . ($size > 5 ? 5 : (max(2, $size))),
241241
]);
242242
return $selectBlock->setOptions($options)
243243
->setValue($value)

app/code/core/Mage/Persistent/Helper/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function isShoppingCartPersist($store = null)
8686
public function getLifeTime($store = null)
8787
{
8888
$lifeTime = Mage::getStoreConfigAsInt(self::XML_PATH_LIFE_TIME, $store);
89-
return ($lifeTime < 0) ? 0 : $lifeTime;
89+
return max(0, $lifeTime);
9090
}
9191

9292
/**

lib/Varien/Image/Adapter/Gd2.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ protected function _convertToByte($memoryValue)
115115
}
116116
$memoryValue = (int) $memoryValue;
117117

118-
return $memoryValue > 0 ? $memoryValue : 0;
118+
return max($memoryValue, 0);
119119
}
120120

121121
public function save($destination = null, $newName = null)

0 commit comments

Comments
 (0)