Issues (3641)

Console/Executor/DataImportersDumpExecutor.php (2 issues)

1
<?php
2
3
/**
4
 * Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace Spryker\Zed\DataImport\Communication\Console\Executor;
9
10
use Spryker\Zed\DataImport\Business\DataImportFacadeInterface;
11
use Spryker\Zed\DataImport\Communication\Console\Parser\DataImportConfigurationParserInterface;
12
use Spryker\Zed\DataImport\DataImportConfig;
13
14
class DataImportersDumpExecutor implements DataImportersDumpExecutorInterface
15
{
16
    /**
17
     * @var \Spryker\Zed\DataImport\Communication\Console\Parser\DataImportConfigurationParserInterface
18
     */
19
    protected $dataImportConfigurationParser;
20
21
    /**
22
     * @var \Spryker\Zed\DataImport\Business\DataImportFacadeInterface
23
     */
24
    protected $dataImportFacade;
25
26
    /**
27
     * @var \Spryker\Zed\DataImport\DataImportConfig
28
     */
29
    protected $dataImportConfig;
30
31
    /**
32
     * @param \Spryker\Zed\DataImport\Communication\Console\Parser\DataImportConfigurationParserInterface $dataImportConfigurationParser
33
     * @param \Spryker\Zed\DataImport\Business\DataImportFacadeInterface $dataImportFacade
34
     * @param \Spryker\Zed\DataImport\DataImportConfig $dataImportConfig
35
     */
36
    public function __construct(
37
        DataImportConfigurationParserInterface $dataImportConfigurationParser,
38
        DataImportFacadeInterface $dataImportFacade,
39
        DataImportConfig $dataImportConfig
40
    ) {
41
        $this->dataImportConfigurationParser = $dataImportConfigurationParser;
42
        $this->dataImportFacade = $dataImportFacade;
43
        $this->dataImportConfig = $dataImportConfig;
44
    }
45
46
    /**
47
     * @return array<string>
48
     */
49
    public function executeDataImportersDump(): array
50
    {
51
        $configPath = $this->dataImportConfig->getDefaultYamlConfigPath();
0 ignored issues
show
Are you sure the assignment to $configPath is correct as $this->dataImportConfig-...DefaultYamlConfigPath() targeting Spryker\Zed\DataImport\D...DefaultYamlConfigPath() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
52
        $dataImportConfigurationTransfer = $this->dataImportConfigurationParser->parseConfigurationFile($configPath);
0 ignored issues
show
$configPath of type null is incompatible with the type string expected by parameter $filename of Spryker\Zed\DataImport\C...arseConfigurationFile(). ( Ignorable by Annotation )

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

52
        $dataImportConfigurationTransfer = $this->dataImportConfigurationParser->parseConfigurationFile(/** @scrutinizer ignore-type */ $configPath);
Loading history...
53
54
        return $this->dataImportFacade->getImportersDumpByConfiguration($dataImportConfigurationTransfer);
55
    }
56
}
57