Skip to content

Commit

Permalink
Fix PHPStan complaint about store method
Browse files Browse the repository at this point in the history
  • Loading branch information
jissereitsma committed Mar 5, 2024
1 parent 4701110 commit 499b0fb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Link/LinkParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Magento\Framework\View\Asset\Repository;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\LayoutInterface;
use Magento\Store\Model\Store;
use Magento\Store\Model\StoreManagerInterface;
use Symfony\Component\DomCrawler\Crawler;
use Yireo\LinkPreload\Config\Config;
Expand Down Expand Up @@ -246,7 +247,9 @@ private function prepareLink(string $link): string
return '';
}

$baseUrl = $this->storeManager->getStore()->getBaseUrl();
/** @var Store $store */
$store = $this->storeManager->getStore();
$baseUrl = $store->getBaseUrl();

if ($link[0] === '/') {
return $link;
Expand All @@ -265,7 +268,6 @@ private function prepareLink(string $link): string
return '';
}

$baseUrl = $this->storeManager->getStore()->getBaseUrl();
if (strpos($link, $baseUrl) === 0) {
$link = '/'.ltrim(substr($link, strlen($baseUrl)), '/');
}
Expand Down

0 comments on commit 499b0fb

Please sign in to comment.