Skip to content

Commit d9fbbb3

Browse files
authored
1 parent b5e4a00 commit d9fbbb3

File tree

11 files changed

+25
-26
lines changed

11 files changed

+25
-26
lines changed

.rector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
CodeQuality\Expression\InlineIfToExplicitIfRector::class, # todo: TMP (!?!)
5656
CodeQuality\Expression\TernaryFalseExpressionToIfRector::class, # todo: TMP (!?!)
5757
CodeQuality\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector::class, # todo: TMP
58-
CodeQuality\FuncCall\SimplifyRegexPatternRector::class, # todo: TMP
5958
CodeQuality\FunctionLike\SimplifyUselessVariableRector::class, # todo: TMP
6059
CodeQuality\Identical\SimplifyBoolIdenticalTrueRector::class, # todo: TMP
6160
CodeQuality\Identical\SimplifyConditionsRector::class, # todo: TMP

app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Abstract.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ public function renderProperty()
130130

131131
if ($this->getColumn()->hasData('width')) {
132132
$customWidth = $this->getColumn()->getData('width');
133-
if (($customWidth === null) || (preg_match('/^[0-9]+%?$/', (string) $customWidth))) {
133+
if (($customWidth === null) || (preg_match('/^\d+%?$/', (string) $customWidth))) {
134134
$width = $customWidth;
135-
} elseif (preg_match('/^([0-9]+)px$/', $customWidth, $matches)) {
135+
} elseif (preg_match('/^(\d+)px$/', $customWidth, $matches)) {
136136
$width = (int) $matches[1];
137137
}
138138
}

app/code/core/Mage/Adminhtml/controllers/RatingController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function saveAction()
8585
$i = 1;
8686
foreach ($options as $key => $optionCode) {
8787
$optionModel = Mage::getModel('rating/rating_option');
88-
if (!preg_match('/^add_([0-9]*?)$/', $key)) {
88+
if (!preg_match('/^add_(\d*?)$/', $key)) {
8989
$optionModel->setId($key);
9090
}
9191

app/code/core/Mage/Catalog/Helper/Product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ public function getProduct($productId, $store, $identifierType = null)
443443

444444
$expectedIdType = false;
445445
if ($identifierType === null) {
446-
if (is_string($productId) && !preg_match('/^[+-]?[1-9][0-9]*$|^0$/', $productId)) {
446+
if (is_string($productId) && !preg_match('/^[+-]?[1-9]\d*$|^0$/', $productId)) {
447447
$expectedIdType = 'sku';
448448
}
449449
}

app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ public function getEditableOptionValue($optionValue)
573573
public function parseOptionValue($optionValue, $productOptionValues)
574574
{
575575
// search quote item option Id in option value
576-
if (preg_match('/\[([0-9]+)\]/', $optionValue, $matches)) {
576+
if (preg_match('/\[(\d+)\]/', $optionValue, $matches)) {
577577
$confItemOptionId = $matches[1];
578578
$option = Mage::getModel('sales/quote_item_option')->load($confItemOptionId);
579579
try {

app/code/core/Mage/Checkout/Model/Resource/Agreement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function _beforeSave(Mage_Core_Model_Abstract $object)
3232
if (!$height) {
3333
$height = '';
3434
}
35-
if ($height && preg_match('/[0-9]$/', $height)) {
35+
if ($height && preg_match('/\d$/', $height)) {
3636
$height .= 'px';
3737
}
3838
$object->setContentHeight($height);

app/code/core/Mage/Cms/Model/Resource/Page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public function getIsUniquePageToStores(Mage_Core_Model_Abstract $object)
265265
*/
266266
protected function isNumericPageIdentifier(Mage_Core_Model_Abstract $object)
267267
{
268-
return preg_match('/^[0-9]+$/', $object->getData('identifier'));
268+
return preg_match('/^\d+$/', $object->getData('identifier'));
269269
}
270270

271271
/**

app/code/core/Mage/Core/Model/Date.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,15 @@ public function parseDateTime($dateTimeString, $dateTimeFormat)
232232
$formats = [
233233
// priority is important!
234234
'%m/%d/%y %I:%M' => [
235-
'/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2})/',
235+
'/^(\d{1,2})\/(\d{1,2})\/(\d{1,2}) (\d{1,2}):(\d{1,2})/',
236236
['y' => 3, 'm' => 1, 'd' => 2, 'h' => 4, 'i' => 5],
237237
],
238238
'm/d/y h:i' => [
239-
'/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2})/',
239+
'/^(\d{1,2})\/(\d{1,2})\/(\d{1,2}) (\d{1,2}):(\d{1,2})/',
240240
['y' => 3, 'm' => 1, 'd' => 2, 'h' => 4, 'i' => 5],
241241
],
242-
'%m/%d/%y' => ['/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{1,2})/', ['y' => 3, 'm' => 1, 'd' => 2]],
243-
'm/d/y' => ['/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{1,2})/', ['y' => 3, 'm' => 1, 'd' => 2]],
242+
'%m/%d/%y' => ['/^(\d{1,2})\/(\d{1,2})\/(\d{1,2})/', ['y' => 3, 'm' => 1, 'd' => 2]],
243+
'm/d/y' => ['/^(\d{1,2})\/(\d{1,2})\/(\d{1,2})/', ['y' => 3, 'm' => 1, 'd' => 2]],
244244
];
245245

246246
foreach ($formats as $supportedFormat => $regRule) {

app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Datetime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function formatDate($date)
5959
return null;
6060
}
6161
// unix timestamp given - simply instantiate date object
62-
if (preg_match('/^[0-9]+$/', $date)) {
62+
if (preg_match('/^\d+$/', $date)) {
6363
$date = new Zend_Date((int) $date);
6464
} elseif (preg_match('#^\d{4}-\d{2}-\d{2}( \d{2}:\d{2}:\d{2})?$#', $date)) {
6565
// international format

app/code/core/Mage/Payment/Model/Method/Cc.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ public function validate()
100100
// Solo only
101101
'SO' => '/(^(6334)[5-9](\d{11}$|\d{13,14}$))|(^(6767)(\d{12}$|\d{14,15}$))/',
102102
// Visa
103-
'VI' => '/^4[0-9]{12}([0-9]{3})?$/',
103+
'VI' => '/^4\d{12}(\d{3})?$/',
104104
// Master Card
105-
'MC' => '/^(5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12}))$/',
105+
'MC' => '/^(5[1-5]\d{14}|2(22[1-9]\d{12}|2[3-9]\d{13}|[3-6]\d{14}|7[0-1]\d{13}|720\d{12}))$/',
106106
// American Express
107-
'AE' => '/^3[47][0-9]{13}$/',
107+
'AE' => '/^3[47]\d{13}$/',
108108
// Discover Network
109109
'DI' => $discoverNetworkRegexp,
110110
// Dinners Club (Belongs to Discover Network)
@@ -177,15 +177,15 @@ public function hasVerification()
177177
public function getVerificationRegEx()
178178
{
179179
return [
180-
'VI' => '/^[0-9]{3}$/', // Visa
181-
'MC' => '/^[0-9]{3}$/', // Master Card
182-
'AE' => '/^[0-9]{4}$/', // American Express
183-
'DI' => '/^[0-9]{3}$/', // Discovery
184-
'SS' => '/^[0-9]{3,4}$/',
185-
'SM' => '/^[0-9]{3,4}$/', // Switch or Maestro
186-
'SO' => '/^[0-9]{3,4}$/', // Solo
187-
'OT' => '/^[0-9]{3,4}$/',
188-
'JCB' => '/^[0-9]{3,4}$/', //JCB
180+
'VI' => '/^\d{3}$/', // Visa
181+
'MC' => '/^\d{3}$/', // Master Card
182+
'AE' => '/^\d{4}$/', // American Express
183+
'DI' => '/^\d{3}$/', // Discovery
184+
'SS' => '/^\d{3,4}$/',
185+
'SM' => '/^\d{3,4}$/', // Switch or Maestro
186+
'SO' => '/^\d{3,4}$/', // Solo
187+
'OT' => '/^\d{3,4}$/',
188+
'JCB' => '/^\d{3,4}$/', //JCB
189189
];
190190
}
191191

0 commit comments

Comments
 (0)