Completed
Push — master ( ba33b0...227996 )
by Derek Stephen
05:32
created

HasCountryTrait::setCountry()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php declare(strict_types=1);
2
3
namespace Del\Traits;
4
5
use Del\Entity\Country;
6
use Del\Factory\CountryFactory;
7
use Doctrine\ORM\Mapping as ORM;
8
9
trait HasCountryTrait
10
{
11
    /**
12
     * @var Country $country
13
     * @ORM\Column(type="string", length=3, nullable=false)
14
     */
15
    private $country;
16
17
    /**
18
     * @return Country
19
     */
20
    public function getCountry(): Country
21
    {
22
        return CountryFactory::generate($this->country);
23
    }
24
25
    /**
26
     * @param Country $country
27
     */
28
    public function setCountry(Country $country): void
29
    {
30
        $this->country = $country->getIso();
0 ignored issues
show
Documentation Bug introduced by
It seems like $country->getIso() of type string is incompatible with the declared type object<Del\Entity\Country> of property $country.

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...
31
    }
32
}
33