Skip to content

Commit 468eaf3

Browse files
authored
phpstan, ref #3784 (#4241)
1 parent 7e5abd1 commit 468eaf3

File tree

10 files changed

+64
-172
lines changed

10 files changed

+64
-172
lines changed

.phpstan.dist.baseline.neon

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,6 @@ parameters:
7070
count: 1
7171
path: app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Settings.php
7272

73-
-
74-
message: "#^Call to an undefined method Mage_Eav_Model_Entity_Attribute\\:\\:isScopeGlobal\\(\\)\\.$#"
75-
count: 2
76-
path: app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php
77-
78-
-
79-
message: "#^Call to an undefined method Mage_Eav_Model_Entity_Attribute\\:\\:isScopeStore\\(\\)\\.$#"
80-
count: 1
81-
path: app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php
82-
83-
-
84-
message: "#^Call to an undefined method Mage_Eav_Model_Entity_Attribute\\:\\:isScopeWebsite\\(\\)\\.$#"
85-
count: 1
86-
path: app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php
87-
8873
-
8974
message: "#^Property Mage_Adminhtml_Block_Customer_Edit_Tab_View_Sales\\:\\:\\$_collection \\(Mage_Sales_Model_Entity_Sale_Collection\\) does not accept Varien_Data_Collection_Db\\.$#"
9075
count: 1
@@ -105,36 +90,6 @@ parameters:
10590
count: 1
10691
path: app/code/core/Mage/Adminhtml/Block/Customer/Sales/Order/Address/Form/Renderer/Vat.php
10792

108-
-
109-
message: "#^Variable \\$d might not be defined\\.$#"
110-
count: 2
111-
path: app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
112-
113-
-
114-
message: "#^Variable \\$localmaxlength might not be defined\\.$#"
115-
count: 1
116-
path: app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
117-
118-
-
119-
message: "#^Variable \\$localmaxvalue might not be defined\\.$#"
120-
count: 1
121-
path: app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
122-
123-
-
124-
message: "#^Variable \\$localminvalue might not be defined\\.$#"
125-
count: 1
126-
path: app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
127-
128-
-
129-
message: "#^Variable \\$class might not be defined\\.$#"
130-
count: 1
131-
path: app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Severity.php
132-
133-
-
134-
message: "#^Variable \\$value might not be defined\\.$#"
135-
count: 1
136-
path: app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Severity.php
137-
13893
-
13994
message: "#^Access to an undefined property Mage_Adminhtml_Block_Notification_Window\\:\\:\\$_aclResourcePath\\.$#"
14095
count: 1
@@ -170,21 +125,6 @@ parameters:
170125
count: 1
171126
path: app/code/core/Mage/Adminhtml/Block/Permissions/Usernroles.php
172127

173-
-
174-
message: "#^Call to an undefined method Mage_Reports_Model_Resource_Report_Collection_Abstract\\:\\:addOrderStatusFilter\\(\\)\\.$#"
175-
count: 1
176-
path: app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php
177-
178-
-
179-
message: "#^Cannot call method setPeriod\\(\\) on Mage_Core_Model_Resource_Db_Collection_Abstract\\|false\\.$#"
180-
count: 4
181-
path: app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php
182-
183-
-
184-
message: "#^Method Mage_Adminhtml_Block_Report_Grid_Abstract\\:\\:addColumn\\(\\) should return Mage_Adminhtml_Block_Report_Grid_Abstract but returns Mage_Adminhtml_Block_Widget_Grid\\.$#"
185-
count: 1
186-
path: app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php
187-
188128
-
189129
message: "#^Property Mage_Adminhtml_Block_Report_Grid_Abstract\\:\\:\\$_columnGroupBy \\(string\\) in isset\\(\\) is not nullable\\.$#"
190130
count: 1
@@ -200,11 +140,6 @@ parameters:
200140
count: 1
201141
path: app/code/core/Mage/Adminhtml/Block/Report/Product/Grid.php
202142

203-
-
204-
message: "#^Call to an undefined method Mage_Reports_Model_Resource_Report_Collection_Abstract\\:\\:addRuleFilter\\(\\)\\.$#"
205-
count: 1
206-
path: app/code/core/Mage/Adminhtml/Block/Report/Sales/Coupons/Grid.php
207-
208143
-
209144
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\\(\\)$#"
210145
count: 1
@@ -280,21 +215,6 @@ parameters:
280215
count: 1
281216
path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging.php
282217

283-
-
284-
message: "#^Variable \\$createLabelUrl might not be defined\\.$#"
285-
count: 1
286-
path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging.php
287-
288-
-
289-
message: "#^Variable \\$itemsGridUrl might not be defined\\.$#"
290-
count: 1
291-
path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging.php
292-
293-
-
294-
message: "#^Variable \\$itemsOrderItemId might not be defined\\.$#"
295-
count: 1
296-
path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging.php
297-
298218
-
299219
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\\(\\)$#"
300220
count: 1
@@ -360,61 +280,6 @@ parameters:
360280
count: 1
361281
path: app/code/core/Mage/Adminhtml/Block/System/Email/Template/Preview.php
362282

363-
-
364-
message: "#^Variable \\$addLabel might not be defined\\.$#"
365-
count: 1
366-
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php
367-
368-
-
369-
message: "#^Variable \\$deleteLabel might not be defined\\.$#"
370-
count: 1
371-
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php
372-
373-
-
374-
message: "#^Variable \\$deleteUrl might not be defined\\.$#"
375-
count: 1
376-
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php
377-
378-
-
379-
message: "#^Variable \\$editLabel might not be defined\\.$#"
380-
count: 1
381-
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php
382-
383-
-
384-
message: "#^Variable \\$saveLabel might not be defined\\.$#"
385-
count: 1
386-
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php
387-
388-
-
389-
message: "#^Variable \\$groupModel might not be defined\\.$#"
390-
count: 18
391-
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php
392-
393-
-
394-
message: "#^Variable \\$showGroupFieldset might not be defined\\.$#"
395-
count: 1
396-
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php
397-
398-
-
399-
message: "#^Variable \\$showStoreFieldset might not be defined\\.$#"
400-
count: 1
401-
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php
402-
403-
-
404-
message: "#^Variable \\$showWebsiteFieldset might not be defined\\.$#"
405-
count: 1
406-
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php
407-
408-
-
409-
message: "#^Variable \\$storeModel might not be defined\\.$#"
410-
count: 21
411-
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php
412-
413-
-
414-
message: "#^Variable \\$websiteModel might not be defined\\.$#"
415-
count: 15
416-
path: app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php
417-
418283
-
419284
message: "#^Call to an undefined method Mage_Tag_Model_Resource_Tag_Collection\\:\\:addAttributeToFilter\\(\\)\\.$#"
420285
count: 1

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function getLabel()
5151
/**
5252
* Check "Use default" checkbox display availability
5353
*
54-
* @param Mage_Eav_Model_Entity_Attribute $attribute
54+
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
5555
* @return bool
5656
*/
5757
public function canDisplayUseDefault($attribute)
@@ -66,7 +66,7 @@ public function canDisplayUseDefault($attribute)
6666
/**
6767
* Check default value usage fact
6868
*
69-
* @param Mage_Eav_Model_Entity_Attribute|string $attribute
69+
* @param Mage_Catalog_Model_Resource_Eav_Attribute|string $attribute
7070
* @return bool
7171
*/
7272
public function usedDefault($attribute)
@@ -104,7 +104,7 @@ public function usedDefault($attribute)
104104
*
105105
* GLOBAL | WEBSITE | STORE
106106
*
107-
* @param Mage_Eav_Model_Entity_Attribute $attribute
107+
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
108108
* @return string
109109
*/
110110
public function getScopeLabel($attribute)
@@ -127,7 +127,7 @@ public function getScopeLabel($attribute)
127127
/**
128128
* Retrieve data object related with form
129129
*
130-
* @return Mage_Catalog_Model_Product | Mage_Catalog_Model_Category
130+
* @return Mage_Catalog_Model_Product|Mage_Catalog_Model_Category
131131
*/
132132
public function getDataObject()
133133
{
@@ -138,7 +138,7 @@ public function getDataObject()
138138
* Retrieve attribute field name
139139
*
140140
*
141-
* @param Mage_Eav_Model_Entity_Attribute $attribute
141+
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
142142
* @return string
143143
*/
144144
public function getAttributeFieldName($attribute)
@@ -153,7 +153,7 @@ public function getAttributeFieldName($attribute)
153153
/**
154154
* Check readonly attribute
155155
*
156-
* @param Mage_Eav_Model_Entity_Attribute|string $attribute
156+
* @param Mage_Catalog_Model_Resource_Eav_Attribute|string $attribute
157157
* @return bool
158158
*/
159159
public function getAttributeReadonly($attribute)

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ public function getChartUrl($directUrl = true)
194194
$dateStart->setTimezone($timezoneLocal);
195195
$dateEnd->setTimezone($timezoneLocal);
196196

197+
$d = '';
197198
$dates = [];
198199
$datas = [];
199200

@@ -256,6 +257,9 @@ public function getChartUrl($directUrl = true)
256257
$dataDelimiter = ',';
257258
$dataSetdelimiter = '|';
258259
$dataMissing = '_';
260+
$localmaxlength = [];
261+
$localmaxvalue = [];
262+
$localminvalue = [];
259263

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

278282
// default values
279-
$yrange = 0;
280283
$yLabels = [];
281284
$miny = 0;
282285
$maxy = 0;
283286
$yorigin = 0;
284287

285-
$maxlength = max($localmaxlength);
286288
if ($minvalue >= 0 && $maxvalue >= 0) {
287289
$miny = 0;
288290
if ($maxvalue > 10) {
@@ -293,15 +295,15 @@ public function getChartUrl($directUrl = true)
293295
$maxy = ceil($maxvalue + 1);
294296
$yLabels = range($miny, $maxy, 1);
295297
}
296-
$yrange = $maxy;
297-
$yorigin = 0;
298298
}
299299

300300
$chartdata = [];
301301

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

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

323-
$labelBuffer = '';
324325
$valueBuffer = [];
325-
$rangeBuffer = '';
326326

327327
if (count($this->_axisLabels)) {
328328
$params['chxt'] = implode(',', array_keys($this->_axisLabels));
@@ -338,8 +338,7 @@ public function getChartUrl($directUrl = true)
338338
case '24h':
339339
$this->_axisLabels[$idx][$_index] = $this->formatTime(
340340
new Zend_Date($_label, 'yyyy-MM-dd HH:00'),
341-
'short',
342-
false
341+
'short'
343342
);
344343
break;
345344
case '7d':
@@ -364,20 +363,22 @@ public function getChartUrl($directUrl = true)
364363
$tmpstring = implode('|', $this->_axisLabels[$idx]);
365364

366365
$valueBuffer[] = $indexid . ':|' . $tmpstring;
366+
// phpcs:ignore Ecg.Performance.Loop.ArraySize
367367
if (count($this->_axisLabels[$idx]) > 1) {
368+
// phpcs:ignore Ecg.Performance.Loop.ArraySize
368369
$deltaX = 100 / (count($this->_axisLabels[$idx]) - 1);
369370
} else {
370371
$deltaX = 100;
371372
}
372373
} elseif ($idx === 'y') {
373374
$valueBuffer[] = $indexid . ':|' . implode('|', $yLabels);
375+
// phpcs:ignore Ecg.Performance.Loop.ArraySize
374376
if (count($yLabels) - 1) {
377+
// phpcs:ignore Ecg.Performance.Loop.ArraySize
375378
$deltaY = 100 / (count($yLabels) - 1);
376379
} else {
377380
$deltaY = 100;
378381
}
379-
// setting range values for y axis
380-
$rangeBuffer = $indexid . ',' . $miny . ',' . $maxy . '|';
381382
}
382383
$indexid++;
383384
}

app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Severity.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function render(Varien_Object $row)
4343
$class = 'minor';
4444
$value = $notice->getSeverities(Mage_AdminNotification_Model_Inbox::SEVERITY_MINOR);
4545
break;
46+
default:
4647
case Mage_AdminNotification_Model_Inbox::SEVERITY_NOTICE:
4748
$class = 'notice';
4849
$value = $notice->getSeverities(Mage_AdminNotification_Model_Inbox::SEVERITY_NOTICE);

0 commit comments

Comments
 (0)