Skip to content

Commit fb601b0

Browse files
authored
Removed all Yoda conditions (#2459)
1 parent 47d5729 commit fb601b0

File tree

279 files changed

+574
-574
lines changed

Some content is hidden

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

279 files changed

+574
-574
lines changed

.github/phpstan-baseline.neon

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Comparison operation \"\\=\\=\" between 1 and \\(Varien_Simplexml_Element\\|null\\) results in an error\\.$#"
4+
message: "#^Comparison operation \"\\=\\=\" between \\(Varien_Simplexml_Element\\|null\\) and 1 results in an error\\.$#"
55
count: 1
66
path: ../app/code/core/Mage/Admin/Model/Config.php
77

@@ -16,7 +16,7 @@ parameters:
1616
path: ../app/code/core/Mage/Admin/Model/Roles.php
1717

1818
-
19-
message: "#^Comparison operation \"\\=\\=\" between 1 and \\(Varien_Simplexml_Element\\|null\\) results in an error\\.$#"
19+
message: "#^Comparison operation \"\\=\\=\" between \\(Varien_Simplexml_Element\\|null\\) and 1 results in an error\\.$#"
2020
count: 1
2121
path: ../app/code/core/Mage/Admin/Model/Roles.php
2222

@@ -371,7 +371,7 @@ parameters:
371371
path: ../app/code/core/Mage/Adminhtml/Block/Page.php
372372

373373
-
374-
message: "#^Comparison operation \"\\=\\=\" between 1 and \\(Varien_Simplexml_Element\\|null\\) results in an error\\.$#"
374+
message: "#^Comparison operation \"\\=\\=\" between \\(Varien_Simplexml_Element\\|null\\) and 1 results in an error\\.$#"
375375
count: 1
376376
path: ../app/code/core/Mage/Adminhtml/Block/Page/Menu.php
377377

@@ -1226,7 +1226,7 @@ parameters:
12261226
path: ../app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized.php
12271227

12281228
-
1229-
message: "#^Comparison operation \"\\=\\=\" between 1 and \\(Varien_Simplexml_Element\\|null\\) results in an error\\.$#"
1229+
message: "#^Comparison operation \"\\=\\=\" between \\(Varien_Simplexml_Element\\|null\\) and 1 results in an error\\.$#"
12301230
count: 1
12311231
path: ../app/code/core/Mage/Adminhtml/Model/System/Config/Source/Admin/Page.php
12321232

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Mage_Admin_Model_Acl extends Zend_Acl
6969
*/
7070
protected function _getRoleRegistry()
7171
{
72-
if (null === $this->_roleRegistry) {
72+
if ($this->_roleRegistry === null) {
7373
$this->_roleRegistry = Mage::getModel('admin/acl_role_registry');
7474
}
7575
return $this->_roleRegistry;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function loadAclResources(Mage_Admin_Model_Acl $acl, $resource = null, $p
111111
}
112112

113113
foreach ($children as $res) {
114-
if (1 == $res->disabled) {
114+
if ($res->disabled == 1) {
115115
continue;
116116
}
117117
$this->loadAclResources($acl, $res, $resourceName);
@@ -128,7 +128,7 @@ public function loadAclResources(Mage_Admin_Model_Acl $acl, $resource = null, $p
128128
public function getAclAssert($name = '')
129129
{
130130
$asserts = $this->getNode("admin/acl/asserts");
131-
if ('' === $name) {
131+
if ($name === '') {
132132
return $asserts;
133133
}
134134

@@ -148,7 +148,7 @@ public function getAclAssert($name = '')
148148
public function getAclPrivilegeSet($name = '')
149149
{
150150
$sets = $this->getNode("admin/acl/privilegeSets");
151-
if ('' === $name) {
151+
if ($name === '') {
152152
return $sets;
153153
}
154154

app/code/core/Mage/Admin/Model/Resource/Acl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function loadRules(Mage_Admin_Model_Acl $acl, array $rulesArr)
125125
$privileges = !empty($rule['privileges']) ? explode(',', $rule['privileges']) : null;
126126

127127
$assert = null;
128-
if (0 != $rule['assert_id']) {
128+
if ($rule['assert_id'] != 0) {
129129
$assertClass = Mage::getSingleton('admin/config')->getAclAssert($rule['assert_type'])->getClassName();
130130
$assert = new $assertClass(unserialize($rule['assert_data'], ['allowed_classes' => false]));
131131
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ protected function _buildResourcesArray(
171171
//check children and run recursion if they exists
172172
$children = $resource->children();
173173
foreach ($children as $key => $child) {
174-
if (1 == $child->disabled) {
174+
if ($child->disabled == 1) {
175175
$resource->{$key} = null;
176176
continue;
177177
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public function getRoles()
239239
*/
240240
public function getRole()
241241
{
242-
if (null === $this->_role) {
242+
if ($this->_role === null) {
243243
$this->_role = Mage::getModel('admin/roles');
244244
$roles = $this->getRoles();
245245
if ($roles && isset($roles[0]) && $roles[0]) {

app/code/core/Mage/Adminhtml/Block/Catalog/Category/Abstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function getRoot($parentNodeCategory=null, $recursionLevel=3)
133133
public function getRootByIds($ids)
134134
{
135135
$root = Mage::registry('root');
136-
if (null === $root) {
136+
if ($root === null) {
137137
$categoryTreeResource = Mage::getResourceSingleton('catalog/category_tree');
138138
$ids = $categoryTreeResource->getExistingCategoryIdsBySpecifiedIds($ids);
139139
$tree = $categoryTreeResource->loadByIds($ids);

app/code/core/Mage/Adminhtml/Block/Page/Menu.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ protected function _buildMenuArray(Varien_Simplexml_Element $parent, $path='', $
125125
$parentArr = array();
126126
$sortOrder = 0;
127127
foreach ($parent->children() as $childName => $child) {
128-
if (1 == $child->disabled) {
128+
if ($child->disabled == 1) {
129129
continue;
130130
}
131131

app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function getItemCreatedAt(array $item, $dateType = 'date', $format = 'med
141141
if (!isset($item['created_at'])) {
142142
return '';
143143
}
144-
if ('date' === $dateType) {
144+
if ($dateType === 'date') {
145145
return $this->helper('core')->formatDate($item['created_at'], $format);
146146
}
147147
return $this->helper('core')->formatTime($item['created_at'], $format);
@@ -170,7 +170,7 @@ public function isItemNotified(array $item, $isSimpleCheck = true)
170170
if ($isSimpleCheck) {
171171
return !empty($item['notified']);
172172
}
173-
return isset($item['notified']) && false !== $item['notified'];
173+
return isset($item['notified']) && $item['notified'] !== false;
174174
}
175175

176176
/**

app/code/core/Mage/Adminhtml/Block/Store/Switcher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ protected function _toHtml()
212212
*/
213213
public function hasDefaultOption($hasDefaultOption = null)
214214
{
215-
if (null !== $hasDefaultOption) {
215+
if ($hasDefaultOption !== null) {
216216
$this->_hasDefaultOption = $hasDefaultOption;
217217
}
218218
return $this->_hasDefaultOption;
@@ -225,7 +225,7 @@ public function hasDefaultOption($hasDefaultOption = null)
225225
*/
226226
public function getHintUrl()
227227
{
228-
if (null === $this->_hintUrl) {
228+
if ($this->_hintUrl === null) {
229229
$this->_hintUrl = Mage::helper('core/hint')->getHintByCode(self::XPATH_HINT_KEY);
230230
}
231231
return $this->_hintUrl;

0 commit comments

Comments
 (0)