Skip to content

[FEAT] @return $this if able #5252

@Hanmac

Description

@Hanmac

Is there an existing issue for this?

  • I have searched the existing issues

Description

Functions like this, that returns $this or patent:: like this:

* @return Mage_Core_Block_Abstract
*/
protected function _prepareLayout()
{
parent::_prepareLayout();
$this->getChild('browse_button')->setLabel(Mage::helper('uploader')->__('...'));
return $this;
}

* @return Mage_Core_Block_Abstract
*/
protected function _prepareLayout()
{
$this->setChild(
'browse_button',
$this->getLayout()->createBlock('adminhtml/widget_button')
->addData([
// Workaround for IE9
'before_html' => sprintf(
'<div style="display:inline-block;" id="%s">',
$this->getElementId(self::DEFAULT_BROWSE_BUTTON_ID_SUFFIX),
),
'after_html' => '</div>',
'id' => $this->getElementId(self::DEFAULT_BROWSE_BUTTON_ID_SUFFIX . '_button'),
'label' => Mage::helper('uploader')->__('Browse Files...'),
'type' => 'button',
]),
);
$this->setChild(
'delete_button',
$this->getLayout()->createBlock('adminhtml/widget_button')
->addData([
'id' => '{{id}}',
'class' => 'delete',
'type' => 'button',
'label' => Mage::helper('uploader')->__('Remove'),
]),
);
$this->_addElementIdsMapping([
'container' => $this->getHtmlId(),
'templateFile' => $this->getElementId('template'),
'browse' => $this->_prepareElementsIds([self::DEFAULT_BROWSE_BUTTON_ID_SUFFIX]),
]);
return parent::_prepareLayout();
}

should return @return $this or : self if able

Expected Behavior

Returns $this

Benefits

My coworker found phpstan warnings, but i currently can't find where openmage would ignore them

Anything else?

I don't know if there is a Rector for this to check

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions