-
-
Notifications
You must be signed in to change notification settings - Fork 450
rector: CombineIfRector
#4880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
rector: CombineIfRector
#4880
Conversation
sreichel
commented
Jul 8, 2025
- see https://getrector.com/rule-detail/combine-if-rector
|
) { | ||
return true; | ||
} | ||
if (($attribute = $this->getAttribute()) && (!$attribute->isScopeGlobal() && $this->getDataObject() && $this->getDataObject()->getId() && $this->getDataObject()->getStoreId())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a long one. Also, it can simplify to return $condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. This doesnt enhance readability.
@@ -160,19 +160,17 @@ public function canReturnToStock() | |||
*/ | |||
public function canReturnItemsToStock() | |||
{ | |||
if (is_null($this->_canReturnToStock)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh boy.. setting something in a if and also in a setter.
'onclick' => Mage::helper('core/js')->getSetLocationJs($this->getCreditMemoUrl()), | ||
]); | ||
} | ||
if ($this->_isAllowedAction('creditmemo') && $this->getInvoice()->getOrder()->canCreditmemo() && ($orderPayment->canRefundPartialPerInvoice() && $this->getInvoice()->canRefund() && $orderPayment->getAmountPaid() > $orderPayment->getAmountRefunded() || $orderPayment->canRefund() && !$this->getInvoice()->getIsUsedForRefund())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also way too long to process. Can refactor do these in a seperate line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check all long lines later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. It would be nice if after a certain character cutoff Rector could stack conditions vertically for better readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hoped php-cs-fixer would jump in to fix it, but seems i have to do it manually.