Skip to content

Commit 1e48ff6

Browse files
committed
update
1 parent 0e55d35 commit 1e48ff6

File tree

57 files changed

+171
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+171
-168
lines changed

.phpstan.dist.baseline.neon

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -708,12 +708,6 @@ parameters:
708708
count: 1
709709
path: app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php
710710

711-
-
712-
message: '#^Parameter \#1 \$order of method Mage_Sales_Model_Resource_Order_Collection_Abstract\:\:setOrderFilter\(\) expects int\|Mage_Sales_Model_Order, array\<string, mixed\> given\.$#'
713-
identifier: argument.type
714-
count: 1
715-
path: app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php
716-
717711
-
718712
message: '#^Parameter \#1 \$prefix of function uniqid expects string, int\<0, max\> given\.$#'
719713
identifier: argument.type
@@ -2574,24 +2568,6 @@ parameters:
25742568
count: 1
25752569
path: app/code/core/Mage/Core/Model/Config.php
25762570

2577-
-
2578-
message: '#^Binary operation "\+" between string and string results in an error\.$#'
2579-
identifier: binaryOp.invalid
2580-
count: 1
2581-
path: app/code/core/Mage/Core/Model/Date.php
2582-
2583-
-
2584-
message: '#^Binary operation "\-" between string and string results in an error\.$#'
2585-
identifier: binaryOp.invalid
2586-
count: 1
2587-
path: app/code/core/Mage/Core/Model/Date.php
2588-
2589-
-
2590-
message: '#^Property Mage_Core_Model_Date\:\:\$_systemOffset is never read, only written\.$#'
2591-
identifier: property.onlyWritten
2592-
count: 1
2593-
path: app/code/core/Mage/Core/Model/Date.php
2594-
25952571
-
25962572
message: '#^Call to an undefined method Mage_Core_Model_Resource_Design\:\:validate\(\)\.$#'
25972573
identifier: method.notFound
@@ -4296,12 +4272,6 @@ parameters:
42964272
count: 1
42974273
path: app/code/core/Mage/Rss/Helper/Data.php
42984274

4299-
-
4300-
message: '#^Property Mage_Rule_Model_Abstract\:\:\$_conditions \(Mage_Rule_Model_Condition_Combine\) in empty\(\) is not falsy\.$#'
4301-
identifier: empty.property
4302-
count: 1
4303-
path: app/code/core/Mage/Rule/Model/Abstract.php
4304-
43054275
-
43064276
message: '#^Call to an undefined method Mage_Rule_Model_Action_Interface\:\:getId\(\)\.$#'
43074277
identifier: method.notFound
@@ -4380,12 +4350,6 @@ parameters:
43804350
count: 1
43814351
path: app/code/core/Mage/Sales/Block/Recurring/Profiles.php
43824352

4383-
-
4384-
message: '#^Parameter \#1 \$order of method Mage_Sales_Model_Resource_Order_Collection_Abstract\:\:setOrderFilter\(\) expects int\|Mage_Sales_Model_Order, array given\.$#'
4385-
identifier: argument.type
4386-
count: 1
4387-
path: app/code/core/Mage/Sales/Model/Api2/Order.php
4388-
43894353
-
43904354
message: '#^Parameter \#2 \$code of method Mage_Api2_Model_Resource\:\:_critical\(\) expects int\|null, string given\.$#'
43914355
identifier: argument.type

.rector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
instanceOf: false,
8585
earlyReturn: false,
8686
strictBooleans: false,
87-
carbon: false,
87+
carbon: true,
8888
rectorPreset: false,
8989
phpunitCodeQuality: true,
9090
doctrineCodeQuality: false,

app/Mage.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* @package Mage
88
*/
99

10+
use Carbon\Carbon;
11+
1012
defined('DS') || define('DS', DIRECTORY_SEPARATOR);
1113
defined('PS') || define('PS', PATH_SEPARATOR);
1214

@@ -830,7 +832,7 @@ public static function isInstalled($options = [])
830832
if (is_readable($localConfigFile)) {
831833
$localConfig = simplexml_load_file($localConfigFile);
832834
date_default_timezone_set('UTC');
833-
if (($date = $localConfig->global->install->date) && strtotime((string) $date)) {
835+
if (($date = $localConfig->global->install->date) && Carbon::parse((string) $date)->getTimestamp()) {
834836
self::$_isInstalled = true;
835837
}
836838
}

app/code/core/Mage/AdminNotification/Model/Feed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function checkUpdate()
9090
*/
9191
public function getDate($rssDate)
9292
{
93-
return gmdate(Varien_Db_Adapter_Pdo_Mysql::TIMESTAMP_FORMAT, strtotime($rssDate));
93+
return gmdate(Varien_Db_Adapter_Pdo_Mysql::TIMESTAMP_FORMAT, Carbon::parse($rssDate)->getTimestamp());
9494
}
9595

9696
/**

app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function getCurrentStatus()
138138
$log = $this->getCustomerLog();
139139
if ($log->getLogoutAt()
140140
|| !$log->getLastVisitAt()
141-
|| strtotime(Carbon::now()->format(Carbon::DEFAULT_TO_STRING_FORMAT)) - strtotime($log->getLastVisitAt()) > Mage_Log_Model_Visitor::getOnlineMinutesInterval() * 60
141+
|| Carbon::parse(Carbon::now()->format(Carbon::DEFAULT_TO_STRING_FORMAT))->getTimestamp() - Carbon::parse($log->getLastVisitAt())->getTimestamp() > Mage_Log_Model_Visitor::getOnlineMinutesInterval() * 60
142142
) {
143143
return Mage::helper('customer')->__('Offline');
144144
}

app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* @package Mage_Adminhtml
99
*/
1010

11+
use Carbon\Carbon;
12+
1113
/**
1214
* Adminhtml dashboard google chart block
1315
*
@@ -211,7 +213,7 @@ public function generateChart(): array
211213
$formats = Mage::app()->getLocale()->getTranslationList('datetime');
212214
$format = $formats['yyMM'] ?? 'MM/yyyy';
213215
$format = str_replace(['yyyy', 'yy', 'MM'], ['Y', 'y', 'm'], $format);
214-
$this->_axisLabels[$idx][$_index] = date($format, strtotime($_label));
216+
$this->_axisLabels[$idx][$_index] = Carbon::parse($_label)->format($format);
215217
break;
216218
}
217219
}

app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Detail.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* @package Mage_Adminhtml
88
*/
99

10+
use Carbon\Carbon;
11+
1012

1113
/**
1214
* Adminhtml transaction detail
@@ -97,7 +99,7 @@ protected function _toHtml()
9799
($this->_txn->getIsClosed()) ? Mage::helper('sales')->__('Yes') : Mage::helper('sales')->__('No'),
98100
);
99101

100-
$createdAt = (strtotime($this->_txn->getCreatedAt()))
102+
$createdAt = (Carbon::parse($this->_txn->getCreatedAt())->getTimestamp())
101103
? $this->formatDate($this->_txn->getCreatedAt(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true)
102104
: $this->__('N/A');
103105
$this->setCreatedAtHtml($this->escapeHtml($createdAt));

app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Time.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* @package Mage_Adminhtml
88
*/
99

10+
use Carbon\Carbon;
11+
1012
/**
1113
* Sitemap grid link column renderer
1214
*
@@ -21,9 +23,6 @@ class Mage_Adminhtml_Block_Sitemap_Grid_Renderer_Time extends Mage_Adminhtml_Blo
2123
*/
2224
public function render(Varien_Object $row)
2325
{
24-
return date(
25-
Mage_Core_Helper_Date::DATETIME_PHP_FORMAT,
26-
strtotime($row->getSitemapTime()) + Mage::getSingleton('core/date')->getGmtOffset(),
27-
);
26+
return Carbon::createFromTimestamp(Carbon::parse($row->getSitemapTime())->getTimestamp() + Mage::getSingleton('core/date')->getGmtOffset())->format(Mage_Core_Helper_Date::DATETIME_PHP_FORMAT);
2827
}
2928
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ public function viewfileAction()
838838
->setHeader('Pragma', 'public', true)
839839
->setHeader('Content-type', $contentType, true)
840840
->setHeader('Content-Length', $contentLength)
841-
->setHeader('Last-Modified', date('r', $contentModify))
841+
->setHeader('Last-Modified', Carbon::createFromTimestamp($contentModify)->format('r'))
842842
->clearBody();
843843
$this->getResponse()->sendHeaders();
844844

app/code/core/Mage/Adminhtml/controllers/System/Config/System/StorageController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function synchronizeAction()
5959
$flag = $this->_getSyncFlag();
6060
if ($flag && $flag->getState() == Mage_Core_Model_File_Storage_Flag::STATE_RUNNING
6161
&& $flag->getLastUpdate()
62-
&& Carbon::now()->lessThanOrEqualTo((string) (strtotime($flag->getLastUpdate()) + Mage_Core_Model_File_Storage_Flag::FLAG_TTL))
62+
&& Carbon::now()->lessThanOrEqualTo((string) (Carbon::parse($flag->getLastUpdate())->getTimestamp() + Mage_Core_Model_File_Storage_Flag::FLAG_TTL))
6363
) {
6464
return;
6565
}
@@ -104,7 +104,7 @@ public function statusAction()
104104
break;
105105
case Mage_Core_Model_File_Storage_Flag::STATE_RUNNING:
106106
if (!$flag->getLastUpdate()
107-
|| Carbon::now()->lessThanOrEqualTo((string) (strtotime($flag->getLastUpdate()) + Mage_Core_Model_File_Storage_Flag::FLAG_TTL))
107+
|| Carbon::now()->lessThanOrEqualTo((string) (Carbon::parse($flag->getLastUpdate())->getTimestamp() + Mage_Core_Model_File_Storage_Flag::FLAG_TTL))
108108
) {
109109
$flagData = $flag->getFlagData();
110110
if (is_array($flagData) && !empty($flagData['source']) && !empty($flagData['destination'])) {

0 commit comments

Comments
 (0)