Skip to content

Commit ec27e6d

Browse files
author
Stanislav Idolov
authored
ENGCOM-2597: Customer Account Navigation: Introduce Spaceship Operator + Strict Types #17071
2 parents 36d3991 + 3df7374 commit ec27e6d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

app/code/Magento/Customer/Block/Account/Navigation.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Customer\Block\Account;
89

@@ -21,7 +22,7 @@ class Navigation extends Links
2122
* {@inheritdoc}
2223
* @since 100.2.0
2324
*/
24-
public function getLinks()
25+
public function getLinks(): array
2526
{
2627
$links = $this->_layout->getChildBlocks($this->getNameInLayout());
2728
$sortableLink = [];
@@ -44,12 +45,8 @@ public function getLinks()
4445
* @return int
4546
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
4647
*/
47-
private function compare(SortLinkInterface $firstLink, SortLinkInterface $secondLink)
48+
private function compare(SortLinkInterface $firstLink, SortLinkInterface $secondLink): int
4849
{
49-
if ($firstLink->getSortOrder() == $secondLink->getSortOrder()) {
50-
return 0;
51-
}
52-
53-
return ($firstLink->getSortOrder() < $secondLink->getSortOrder()) ? 1 : -1;
50+
return $firstLink->getSortOrder() <=> $secondLink->getSortOrder();
5451
}
5552
}

0 commit comments

Comments
 (0)