Skip to content

Commit

Permalink
Fix some PHPStan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
justinbeaty committed Jul 13, 2022
1 parent 98a5a48 commit 2069699
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 36 deletions.
14 changes: 0 additions & 14 deletions app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Tab/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,6 @@ protected function _prepareForm()
'class' => 'validate-digits',
));

$fieldset->addField('is_wysiwyg_enabled', 'select', array(
'name' => 'is_wysiwyg_enabled',
'label' => Mage::helper('eav')->__('Enable WYSIWYG'),
'title' => Mage::helper('eav')->__('Enable WYSIWYG'),
'values' => $yesnoSource,
));

// define field dependencies
$this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
->addFieldMap("is_wysiwyg_enabled", 'wysiwyg_enabled')
->addFieldMap("frontend_input", 'frontend_input_type')
->addFieldDependence('wysiwyg_enabled', 'frontend_input_type', 'textarea')
);

Mage::dispatchEvent("adminhtml_{$attributeObject->getEntityTypeCode()}_attribute_edit_prepare_form", array(
'form' => $form,
'attribute' => $attributeObject
Expand Down
5 changes: 3 additions & 2 deletions app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ class Mage_Eav_Block_Adminhtml_Attribute_Grid extends Mage_Eav_Block_Adminhtml_A
protected function _prepareCollection()
{
if ($entity_type = Mage::registry('entity_type')) {
$collection = Mage::getResourceModel($entity_type->getEntityAttributeCollection())
->setEntityTypeFilter($entity_type->getEntityTypeId());
/** @var $collection Mage_Eav_Model_Resource_Entity_Attribute_Collection */
$collection = Mage::getResourceModel($entity_type->getEntityAttributeCollection());
$collection->setEntityTypeFilter($entity_type->getEntityTypeId());
$this->setCollection($collection);
}
return parent::_prepareCollection();
Expand Down
33 changes: 18 additions & 15 deletions app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Set/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,11 @@ public function getGroupTreeJson()
$item['allowDrop'] = true;
$item['allowDrag'] = true;

$nodeChildren = Mage::getResourceModel($entity_type->getEntityAttributeCollection())
->setEntityTypeFilter($entity_type->getEntityTypeId())
->setAttributeGroupFilter($node->getId())
->load();
/** @var $nodeChildren Mage_Eav_Model_Entity_Attribute */
$nodeChildren = Mage::getResourceModel($entity_type->getEntityAttributeCollection());
$nodeChildren->setEntityTypeFilter($entity_type->getEntityTypeId())
->setAttributeGroupFilter($node->getId())
->load();

if ($nodeChildren->getSize() > 0) {
$item['children'] = array();
Expand Down Expand Up @@ -234,22 +235,24 @@ public function getAttributeTreeJson()
/* @var $entity_type Mage_Eav_Model_Entity_Type */
$entity_type = Mage::registry('entity_type');

$collection = Mage::getResourceModel($entity_type->getEntityAttributeCollection())
->setEntityTypeFilter($entity_type->getEntityTypeId())
->setAttributeSetFilter($setId)
->load();
/** @var $collection Mage_Eav_Model_Resource_Entity_Attribute_Collection */
$collection = Mage::getResourceModel($entity_type->getEntityAttributeCollection());
$collection->setEntityTypeFilter($entity_type->getEntityTypeId())
->setAttributeSetFilter($setId)
->load();

$attributesIds = array('0');
/* @var $item Mage_Eav_Model_Entity_Attribute */
foreach ($collection->getItems() as $item) {
$attributesIds[] = $item->getAttributeId();
}

$attributes = Mage::getResourceModel($entity_type->getEntityAttributeCollection())
->setEntityTypeFilter($entity_type->getEntityTypeId())
->setAttributesExcludeFilter($attributesIds)
->setOrder('attribute_code', 'asc')
->load();
/** @var $attributes Mage_Eav_Model_Resource_Entity_Attribute_Collection */
$attributes = Mage::getResourceModel($entity_type->getEntityAttributeCollection());
$attributes->setEntityTypeFilter($entity_type->getEntityTypeId())
->setAttributesExcludeFilter($attributesIds)
->setOrder('attribute_code', 'asc')
->load();

foreach ($attributes as $child) {
$attr = array(
Expand Down Expand Up @@ -355,7 +358,7 @@ public function getRenameButton()
/**
* Retrieve current Attribute Set object
*
* @return Mage_Eav_Model_Entity_Set
* @return Mage_Eav_Model_Entity_Attribute_Set
*/
protected function _getAttributeSet()
{
Expand Down Expand Up @@ -392,7 +395,7 @@ public function getIsCurrentSetDefault()
* Retrieve current Attribute Set object
*
* @deprecated use _getAttributeSet
* @return Mage_Eav_Model_Entity_Set
* @return Mage_Eav_Model_Entity_Attribute_Set
*/
protected function _getSetData()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,10 @@ public function validateAction()

$attributeCode = $this->getRequest()->getParam('attribute_code');
$attributeId = $this->getRequest()->getParam('attribute_id');
$attribute = Mage::getModel($this->_entityType->getAttributeModel())
->loadByCode($this->_entityType->getEntityTypeId(), $attributeCode);

/** @var $attribute Mage_Eav_Model_Entity_Attribute */
$attribute = Mage::getModel($this->_entityType->getAttributeModel());
$attribute->loadByCode($this->_entityType->getEntityTypeId(), $attributeCode);

if ($attribute->getId() && !$attributeId) {
Mage::getSingleton('adminhtml/session')->addError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ public function saveAction()

/* @var $model Mage_Eav_Model_Entity_Attribute_Set */
$model = Mage::getModel('eav/entity_attribute_set')
->setEntityTypeId($entityTypeId);
->setEntityTypeId($entityTypeId);

/** @var $helper Mage_Adminhtml_Helper_Data */
$helper = Mage::helper('adminhtml');
/* @var $helper Mage_Eav_Helper_Data */
$helper = Mage::helper('eav');

try {
if ($isNewSet) {
Expand Down

0 comments on commit 2069699

Please sign in to comment.