Issues (9)

src/Base/View/Other/UsesView.php (2 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Prometee\SwaggerClientGenerator\Base\View\Other;
6
7
use Exception;
8
use Prometee\SwaggerClientGenerator\Base\Generator\Other\UsesGeneratorInterface;
9
10
/**
11
* @param UsesGeneratorInterface $generator
12
 */
13
class UsesView extends AbstractArrayView implements UsesViewInterface
14
{
15
    /**
16
     * {@inheritDoc}
17
     */
18
    public function getArrayToBuild(): array
19
    {
20
        return $this->generator->getUses();
0 ignored issues
show
The method getUses() does not exist on null. ( Ignorable by Annotation )

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

20
        return $this->generator->/** @scrutinizer ignore-call */ getUses();

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...
The method getUses() does not exist on Prometee\SwaggerClientGe...ator\GeneratorInterface. It seems like you code against a sub-type of Prometee\SwaggerClientGe...ator\GeneratorInterface such as Prometee\SwaggerClientGe...\UsesGeneratorInterface or Prometee\SwaggerClientGe...tor\Other\UsesGenerator. ( Ignorable by Annotation )

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

20
        return $this->generator->/** @scrutinizer ignore-call */ getUses();
Loading history...
21
    }
22
23
    /**
24
     * {@inheritDoc}
25
     *
26
     * @throws Exception
27
     */
28
    public function build(string $indent = null, string $eol = null): ?string
29
    {
30
        $content = parent::build($indent, $eol);
31
32
        if (empty($content)) {
33
            return $content;
34
        }
35
36
        return $content.$this->eol;
37
    }
38
39
    /**
40
     * {@inheritDoc}
41
     */
42
    public function buildArrayItemString($key, string $item): string
43
    {
44
        $alias = '';
45
        if (!empty($item)) {
46
            $alias = sprintf(' as %s', $item);
47
        }
48
49
        return sprintf('use %s%s;%s',
50
            $key,
51
            $alias,
52
            $this->eol
53
        );
54
    }
55
}