Issues (4)

src/Generator.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace ByTIC\Namefy;
4
5
use ByTIC\Namefy\Strategies\AbstractStrategy;
6
use ByTIC\Namefy\Strategies\ByTICStrategy;
7
8
/**
9
 * Class Generator
10
 * @package ByTIC\Namefy
11
 */
12
class Generator
13
{
14
    use Generator\HasStrategy;
15
16
    /**
17
     * Generator constructor.
18
     * @param null|string|AbstractStrategy $strategy
19
     */
20
    public function __construct($strategy = null)
21
    {
22
        $strategy = (empty($strategy)) ? ByTICStrategy::class : $strategy;
23
        $this->setStrategy($strategy);
24
    }
25
26
    /**
27
     * @param $name
28
     * @param $type
29
     * @return Name
30
     */
31
    public function from($name, $type): Name
32
    {
33
        return NameFactory::from($name, $type, $this->getStrategy());
0 ignored issues
show
It seems like $this->getStrategy() can also be of type null; however, parameter $strategy of ByTIC\Namefy\NameFactory::from() does only seem to accept ByTIC\Namefy\Strategies\AbstractStrategy, maybe add an additional type check? ( Ignorable by Annotation )

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

33
        return NameFactory::from($name, $type, /** @scrutinizer ignore-type */ $this->getStrategy());
Loading history...
34
    }
35
}
36