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

Cleanup: don't use void return value from method calls. #39516

Open
wants to merge 2 commits into
base: 2.4-develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
40 changes: 18 additions & 22 deletions app/code/Magento/Downloadable/Model/Product/TypeHandler/Link.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2015 Adobe
* All Rights Reserved.
*/
namespace Magento\Downloadable\Model\Product\TypeHandler;

Expand All @@ -10,7 +10,6 @@
use Magento\Downloadable\Model\ComponentInterface;

/**
* Class Link
* @api
* @since 100.0.2
*/
Expand All @@ -22,7 +21,7 @@ class Link extends AbstractTypeHandler
private $sampleItem = [];

/**
* @var \Magento\Downloadable\Model\ComponentInterfaceFactory
* @var \Magento\Downloadable\Model\LinkFactory
*/
private $linkFactory;

Expand All @@ -49,54 +48,55 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getDataKey()
{
return 'link';
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getIdentifierKey()
{
return 'link_id';
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function save(Product $product, array $data)
{
parent::save($product, $data);

if ($product->getLinksPurchasedSeparately()) {
$product->setIsCustomOptionChanged();
}

return $this;
}

/**
* {@inheritdoc}
* @inheritdoc
*/
protected function clear()
{
$this->sampleItem = [];
return parent::clear();

parent::clear();
}

/**
* @return ComponentInterface
* @inheritdoc
*/
protected function createItem()
{
return $this->linkFactory->create();
}

/**
* @param ComponentInterface $model
* @param array $data
* @param Product $product
* @return void
* @inheritdoc
*/
protected function setDataToModel(ComponentInterface $model, array $data, Product $product)
{
Expand Down Expand Up @@ -124,17 +124,15 @@ protected function setDataToModel(ComponentInterface $model, array $data, Produc
}

/**
* @param ComponentInterface $model
* @param Product $product
* @return void
* @inheritdoc
*/
protected function linkToProduct(ComponentInterface $model, Product $product)
{
$product->setLastAddedLinkId($model->getId());
}

/**
* @return void
* @inheritdoc
*/
protected function processDelete()
{
Expand All @@ -144,7 +142,7 @@ protected function processDelete()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
protected function saveItem(Product $product, array $item)
{
Expand All @@ -156,9 +154,7 @@ protected function saveItem(Product $product, array $item)
}

/**
* @param ComponentInterface $model
* @param array $files
* @return void
* @inheritdoc
*/
protected function setFiles(ComponentInterface $model, array $files)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2015 Adobe
* All Rights Reserved.
*/
namespace Magento\Eav\Model\ResourceModel\Entity\Attribute;

Expand Down Expand Up @@ -156,12 +156,12 @@ public function updateDefaultGroup($attributeSetId)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
protected function saveNewObject(AbstractModel $object)
{
try {
return parent::saveNewObject($object);
parent::saveNewObject($object);
} catch (DuplicateException $e) {
throw new AttributeGroupAlreadyExistsException(
__(
Expand All @@ -173,12 +173,12 @@ protected function saveNewObject(AbstractModel $object)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
protected function updateObject(AbstractModel $object)
{
try {
return parent::updateObject($object);
parent::updateObject($object);
} catch (DuplicateException $e) {
throw new AttributeGroupAlreadyExistsException(
__(
Expand Down
23 changes: 15 additions & 8 deletions app/code/Magento/Store/Block/Store/Switcher.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2014 Adobe
* All Rights Reserved.
*/

/**
Expand Down Expand Up @@ -29,15 +29,11 @@ class Switcher extends \Magento\Framework\View\Element\Template
protected $_loaded = false;

/**
* Store factory
*
* @var \Magento\Store\Model\StoreFactory
*/
protected $_storeFactory;

/**
* Store group factory
*
* @var \Magento\Store\Model\GroupFactory
*/
protected $_storeGroupFactory;
Expand All @@ -60,17 +56,20 @@ public function __construct(
}

/**
* @return void
* @inheritdoc
*/
protected function _construct()
{
$this->_loadData();
$this->setStores([]);
$this->setLanguages([]);
return parent::_construct();

parent::_construct();
}

/**
* Load data
*
* @return $this
*/
protected function _loadData()
Expand Down Expand Up @@ -104,6 +103,8 @@ protected function _loadData()
}

/**
* Sets stores and returns their count
*
* @return int
*/
public function getStoreCount()
Expand Down Expand Up @@ -134,6 +135,8 @@ public function getStoreCount()
}

/**
* Sets languages and returns their count
*
* @return int
*/
public function getLanguageCount()
Expand All @@ -148,6 +151,8 @@ public function getLanguageCount()
}

/**
* Returns current store id
*
* @return int
*/
public function getCurrentStoreId()
Expand All @@ -156,6 +161,8 @@ public function getCurrentStoreId()
}

/**
* Returns current store code
*
* @return string
*/
public function getCurrentStoreCode()
Expand Down
10 changes: 4 additions & 6 deletions lib/internal/Magento/Framework/HTTP/Client/Socket.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2014 Adobe
* All Rights Reserved.
*/

/**
Expand Down Expand Up @@ -419,8 +419,7 @@ protected function processResponse()

$line = explode(" ", $responseLine, 3);
if (count($line) != 3) {
// phpstan:ignore "Result of method Magento\Framework\HTTP\Client\Socket::doError() (void) is used."
return $this->doError("Invalid response line returned from server: " . $responseLine);
$this->doError("Invalid response line returned from server: " . $responseLine);
}
$this->_responseStatus = (int)$line[1];
$this->processResponseHeaders();
Expand Down Expand Up @@ -466,8 +465,7 @@ protected function makeRequest($method, $uri, $params = [])
$errno = $errstr = '';
$this->_sock = @fsockopen($this->_host, $this->_port, $errno, $errstr, $this->_timeout);
if (!$this->_sock) {
// phpstan:ignore "Result of method Magento\Framework\HTTP\Client\Socket::doError() (void) is used."
return $this->doError(sprintf("[errno: %d] %s", $errno, $errstr));
$this->doError(sprintf("[errno: %d] %s", $errno, $errstr));
}

$crlf = "\r\n";
Expand Down