Skip to content
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

Correct return type of methods and typo correction. #15993

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

use Magento\Backend\App\Action\Context;
use Magento\Catalog\Model\Category;
use Magento\Customer\Model\Attribute\Data\Boolean;
use Magento\Framework\Registry;

class CategoriesJson extends \Magento\CatalogRule\Controller\Adminhtml\Promo\Widget
Expand All @@ -32,7 +33,7 @@ public function __construct(Context $context, Registry $coreRegistry)
/**
* Initialize category object in registry
*
* @return Category
* @return Category|Boolean
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How this method can return Boolean class?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orlangur
Method returns false value at if $rootid not found in category path ids.

if (!in_array($rootId, $category->getPathIds())) {
$this->_redirect('catalog/*/', ['_current' => true, 'id' => null]);
return false;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

false is bool primitive type, it has nothing to do with Boolean class.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay.Thanks for helping. Should i add simple boolean or leave it as it is and remove file from PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add |bool and remove unneeded class import.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I update the file. Please review it.

*/
protected function _initCategory()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function processAttributeValue($attribute, $value)
*
* @param array $index
* @param string $separator
* @return string
* @return array
*/
public function prepareEntityIndex($index, $separator = ' ')
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/UrlRewrite/Service/V1/Data/UrlRewrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function getUrlRewriteId()

/**
* @param int $urlRewriteId
* @return int
* @return $this
*/
public function setUrlRewriteId($urlRewriteId)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getAdminPasswordLifetime()
}

/**
* Get admin maxiumum security failures from config
* Get admin maximum security failures from config
*
* @return int
*/
Expand Down