Issues (11)

Block/Customer/Address.php (2 issues)

1
<?php
2
/**
3
 * Copyright © O2TI. All rights reserved.
4
 *
5
 * @author    Bruno Elisei <[email protected]>
6
 * See COPYING.txt for license details.
7
 */
8
declare(strict_types=1);
9
10
namespace O2TI\AutoCompleteAddressBr\Block\Customer;
11
12
use Magento\Framework\App\Config\ScopeConfigInterface;
13
use Magento\Framework\View\Element\Template;
14
use Magento\Framework\View\Element\Template\Context;
15
use Magento\Store\Model\ScopeInterface;
16
use Magento\Store\Model\StoreManagerInterface;
17
use O2TI\AutoCompleteAddressBr\Helper\Config;
18
19
/**
20
 *  Edit - Change Template Edit Account.
21
 */
22
class Address extends Template
23
{
24
    /**
25
     * @var Config
26
     */
27
    private $config;
28
29
    /**
30
     * @var ScopeInterface
31
     */
32
    private $scopeConfig;
33
34
    /**
35
     * @var StoreManagerInterface
36
     */
37
    private $storeManagerInterface;
38
39
    /**
40
     * @param ScopeConfigInterface  $scopeConfig
41
     * @param StoreManagerInterface $storeManagerInterface
42
     * @param Context               $context
43
     * @param Config                $config
44
     * @param array                 $data
45
     */
46
    public function __construct(
47
        ScopeConfigInterface $scopeConfig,
48
        StoreManagerInterface $storeManagerInterface,
49
        Context $context,
50
        Config $config,
51
        array $data = []
52
    ) {
53
        $this->scopeConfig = $scopeConfig;
0 ignored issues
show
Documentation Bug introduced by
It seems like $scopeConfig of type Magento\Framework\App\Config\ScopeConfigInterface is incompatible with the declared type Magento\Store\Model\ScopeInterface of property $scopeConfig.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
54
        $this->storeManagerInterface = $storeManagerInterface;
55
        $this->config = $config;
56
        parent::__construct($context, $data);
57
    }
58
59
    /**
60
     * Get Configs Module.
61
     *
62
     * @param string $field
63
     *
64
     * @return string
65
     */
66
    public function getConfigForModule(string $field): ?string
67
    {
68
        $storeId = $this->storeManagerInterface->getStore()->getId();
69
        $configPath = sprintf(Config::CONFIG_PATH_GENERAL, $field);
70
71
        return $this->scopeConfig->getValue($configPath, ScopeInterface::SCOPE_STORE, $storeId);
0 ignored issues
show
The method getValue() does not exist on Magento\Store\Model\ScopeInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

71
        return $this->scopeConfig->/** @scrutinizer ignore-call */ getValue($configPath, ScopeInterface::SCOPE_STORE, $storeId);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
72
    }
73
}
74