Skip to content

Commit

Permalink
Merge branch 'main' into ref-2847-phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel authored Oct 9, 2024
2 parents b6d5b64 + 7f61f77 commit 123aa8f
Show file tree
Hide file tree
Showing 43 changed files with 648 additions and 214 deletions.
135 changes: 0 additions & 135 deletions .phpstan.dist.baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,6 @@ parameters:
count: 1
path: app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Settings.php

-
message: "#^Call to an undefined method Mage_Eav_Model_Entity_Attribute\\:\\:isScopeGlobal\\(\\)\\.$#"
count: 2
path: app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php

-
message: "#^Call to an undefined method Mage_Eav_Model_Entity_Attribute\\:\\:isScopeStore\\(\\)\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php

-
message: "#^Call to an undefined method Mage_Eav_Model_Entity_Attribute\\:\\:isScopeWebsite\\(\\)\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php

-
message: "#^Property Mage_Adminhtml_Block_Customer_Edit_Tab_View_Sales\\:\\:\\$_collection \\(Mage_Sales_Model_Entity_Sale_Collection\\) does not accept Varien_Data_Collection_Db\\.$#"
count: 1
Expand All @@ -105,36 +90,6 @@ parameters:
count: 1
path: app/code/core/Mage/Adminhtml/Block/Customer/Sales/Order/Address/Form/Renderer/Vat.php

-
message: "#^Variable \\$d might not be defined\\.$#"
count: 2
path: app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php

-
message: "#^Variable \\$localmaxlength might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php

-
message: "#^Variable \\$localmaxvalue might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php

-
message: "#^Variable \\$localminvalue might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php

-
message: "#^Variable \\$class might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Severity.php

-
message: "#^Variable \\$value might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Severity.php

-
message: "#^Access to an undefined property Mage_Adminhtml_Block_Notification_Window\\:\\:\\$_aclResourcePath\\.$#"
count: 1
Expand Down Expand Up @@ -170,21 +125,6 @@ parameters:
count: 1
path: app/code/core/Mage/Adminhtml/Block/Permissions/Usernroles.php

-
message: "#^Call to an undefined method Mage_Reports_Model_Resource_Report_Collection_Abstract\\:\\:addOrderStatusFilter\\(\\)\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php

-
message: "#^Cannot call method setPeriod\\(\\) on Mage_Core_Model_Resource_Db_Collection_Abstract\\|false\\.$#"
count: 4
path: app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php

-
message: "#^Method Mage_Adminhtml_Block_Report_Grid_Abstract\\:\\:addColumn\\(\\) should return Mage_Adminhtml_Block_Report_Grid_Abstract but returns Mage_Adminhtml_Block_Widget_Grid\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php

-
message: "#^Property Mage_Adminhtml_Block_Report_Grid_Abstract\\:\\:\\$_columnGroupBy \\(string\\) in isset\\(\\) is not nullable\\.$#"
count: 1
Expand All @@ -200,11 +140,6 @@ parameters:
count: 1
path: app/code/core/Mage/Adminhtml/Block/Report/Product/Grid.php

-
message: "#^Call to an undefined method Mage_Reports_Model_Resource_Report_Collection_Abstract\\:\\:addRuleFilter\\(\\)\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/Report/Sales/Coupons/Grid.php

-
message: "#^Return type \\(int\\) of method Mage_Adminhtml_Block_Review_Grid_Filter_Type\\:\\:getCondition\\(\\) should be compatible with return type \\(array\\|null\\) of method Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Select\\:\\:getCondition\\(\\)$#"
count: 1
Expand Down Expand Up @@ -280,21 +215,6 @@ parameters:
count: 1
path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging.php

-
message: "#^Variable \\$createLabelUrl might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging.php

-
message: "#^Variable \\$itemsGridUrl might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging.php

-
message: "#^Variable \\$itemsOrderItemId might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging.php

-
message: "#^Return type \\(Mage_Sales_Model_Order_Shipment\\) of method Mage_Adminhtml_Block_Sales_Order_Shipment_View_Items\\:\\:getSource\\(\\) should be compatible with return type \\(Mage_Sales_Model_Order_Invoice\\) of method Mage_Adminhtml_Block_Sales_Items_Abstract\\:\\:getSource\\(\\)$#"
count: 1
Expand Down Expand Up @@ -360,61 +280,6 @@ parameters:
count: 1
path: app/code/core/Mage/Adminhtml/Block/System/Email/Template/Preview.php

-
message: "#^Variable \\$addLabel might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php

-
message: "#^Variable \\$deleteLabel might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php

-
message: "#^Variable \\$deleteUrl might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php

-
message: "#^Variable \\$editLabel might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php

-
message: "#^Variable \\$saveLabel might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php

-
message: "#^Variable \\$groupModel might not be defined\\.$#"
count: 18
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php

-
message: "#^Variable \\$showGroupFieldset might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php

-
message: "#^Variable \\$showStoreFieldset might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php

-
message: "#^Variable \\$showWebsiteFieldset might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php

-
message: "#^Variable \\$storeModel might not be defined\\.$#"
count: 21
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php

-
message: "#^Variable \\$websiteModel might not be defined\\.$#"
count: 15
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php

-
message: "#^Call to an undefined method Mage_Tag_Model_Resource_Tag_Collection\\:\\:addAttributeToFilter\\(\\)\\.$#"
count: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function getLabel()
/**
* Check "Use default" checkbox display availability
*
* @param Mage_Eav_Model_Entity_Attribute $attribute
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
* @return bool
*/
public function canDisplayUseDefault($attribute)
Expand All @@ -66,7 +66,7 @@ public function canDisplayUseDefault($attribute)
/**
* Check default value usage fact
*
* @param Mage_Eav_Model_Entity_Attribute|string $attribute
* @param Mage_Catalog_Model_Resource_Eav_Attribute|string $attribute
* @return bool
*/
public function usedDefault($attribute)
Expand Down Expand Up @@ -104,7 +104,7 @@ public function usedDefault($attribute)
*
* GLOBAL | WEBSITE | STORE
*
* @param Mage_Eav_Model_Entity_Attribute $attribute
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
* @return string
*/
public function getScopeLabel($attribute)
Expand All @@ -127,7 +127,7 @@ public function getScopeLabel($attribute)
/**
* Retrieve data object related with form
*
* @return Mage_Catalog_Model_Product | Mage_Catalog_Model_Category
* @return Mage_Catalog_Model_Product|Mage_Catalog_Model_Category
*/
public function getDataObject()
{
Expand All @@ -138,7 +138,7 @@ public function getDataObject()
* Retrieve attribute field name
*
*
* @param Mage_Eav_Model_Entity_Attribute $attribute
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
* @return string
*/
public function getAttributeFieldName($attribute)
Expand All @@ -153,7 +153,7 @@ public function getAttributeFieldName($attribute)
/**
* Check readonly attribute
*
* @param Mage_Eav_Model_Entity_Attribute|string $attribute
* @param Mage_Catalog_Model_Resource_Eav_Attribute|string $attribute
* @return bool
*/
public function getAttributeReadonly($attribute)
Expand Down
25 changes: 13 additions & 12 deletions app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ public function getChartUrl($directUrl = true)
$dateStart->setTimezone($timezoneLocal);
$dateEnd->setTimezone($timezoneLocal);

$d = '';
$dates = [];
$datas = [];

Expand Down Expand Up @@ -256,6 +257,9 @@ public function getChartUrl($directUrl = true)
$dataDelimiter = ',';
$dataSetdelimiter = '|';
$dataMissing = '_';
$localmaxlength = [];
$localmaxvalue = [];
$localminvalue = [];

// process each string in the array, and find the max length
foreach ($this->getAllSeries() as $index => $serie) {
Expand All @@ -276,13 +280,11 @@ public function getChartUrl($directUrl = true)
}

// default values
$yrange = 0;
$yLabels = [];
$miny = 0;
$maxy = 0;
$yorigin = 0;

$maxlength = max($localmaxlength);
if ($minvalue >= 0 && $maxvalue >= 0) {
$miny = 0;
if ($maxvalue > 10) {
Expand All @@ -293,15 +295,15 @@ public function getChartUrl($directUrl = true)
$maxy = ceil($maxvalue + 1);
$yLabels = range($miny, $maxy, 1);
}
$yrange = $maxy;
$yorigin = 0;
}

$chartdata = [];

foreach ($this->getAllSeries() as $index => $serie) {
foreach ($this->getAllSeries() as $serie) {
$thisdataarray = $serie;
for ($j = 0; $j < count($thisdataarray); $j++) {
// phpcs:ignore Ecg.Performance.Loop.ArraySize
$thisdataarrayCount = count($thisdataarray);
for ($j = 0; $j < $thisdataarrayCount; $j++) {
$currentvalue = $thisdataarray[$j];
if (is_numeric($currentvalue)) {
$ylocation = $yorigin + $currentvalue;
Expand All @@ -320,9 +322,7 @@ public function getChartUrl($directUrl = true)

$params['chd'] .= $buffer;

$labelBuffer = '';
$valueBuffer = [];
$rangeBuffer = '';

if (count($this->_axisLabels)) {
$params['chxt'] = implode(',', array_keys($this->_axisLabels));
Expand All @@ -338,8 +338,7 @@ public function getChartUrl($directUrl = true)
case '24h':
$this->_axisLabels[$idx][$_index] = $this->formatTime(
new Zend_Date($_label, 'yyyy-MM-dd HH:00'),
'short',
false
'short'
);
break;
case '7d':
Expand All @@ -364,20 +363,22 @@ public function getChartUrl($directUrl = true)
$tmpstring = implode('|', $this->_axisLabels[$idx]);

$valueBuffer[] = $indexid . ':|' . $tmpstring;
// phpcs:ignore Ecg.Performance.Loop.ArraySize
if (count($this->_axisLabels[$idx]) > 1) {
// phpcs:ignore Ecg.Performance.Loop.ArraySize
$deltaX = 100 / (count($this->_axisLabels[$idx]) - 1);
} else {
$deltaX = 100;
}
} elseif ($idx === 'y') {
$valueBuffer[] = $indexid . ':|' . implode('|', $yLabels);
// phpcs:ignore Ecg.Performance.Loop.ArraySize
if (count($yLabels) - 1) {
// phpcs:ignore Ecg.Performance.Loop.ArraySize
$deltaY = 100 / (count($yLabels) - 1);
} else {
$deltaY = 100;
}
// setting range values for y axis
$rangeBuffer = $indexid . ',' . $miny . ',' . $maxy . '|';
}
$indexid++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function render(Varien_Object $row)
$class = 'minor';
$value = $notice->getSeverities(Mage_AdminNotification_Model_Inbox::SEVERITY_MINOR);
break;
default:
case Mage_AdminNotification_Model_Inbox::SEVERITY_NOTICE:
$class = 'notice';
$value = $notice->getSeverities(Mage_AdminNotification_Model_Inbox::SEVERITY_NOTICE);
Expand Down
Loading

0 comments on commit 123aa8f

Please sign in to comment.