These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Ae\FeatureBundle\Entity; |
||
4 | |||
5 | use Doctrine\ORM\Mapping as ORM; |
||
6 | |||
7 | /** |
||
8 | * Ae\FeatureBundle\Entity\Feature. |
||
9 | * |
||
10 | * @ORM\Table(name="application_feature") |
||
11 | * @ORM\Entity |
||
12 | */ |
||
13 | class Feature |
||
14 | { |
||
15 | /** |
||
16 | * @var int |
||
17 | * |
||
18 | * @ORM\Column(type="integer") |
||
19 | * @ORM\Id |
||
20 | * @ORM\GeneratedValue(strategy="AUTO") |
||
21 | */ |
||
22 | private $id; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | * |
||
27 | * @ORM\Column(length=250) |
||
28 | */ |
||
29 | private $name; |
||
30 | |||
31 | /** |
||
32 | * @var bool |
||
33 | * |
||
34 | * @ORM\Column(type="boolean") |
||
35 | */ |
||
36 | private $enabled; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | * |
||
41 | * @ORM\Column(type="text", nullable=true) |
||
42 | */ |
||
43 | private $role; |
||
44 | |||
45 | /** |
||
46 | * @var ArrayCollection |
||
47 | * |
||
48 | * @ORM\OneToMany(targetEntity="Feature", mappedBy="parent") |
||
49 | */ |
||
50 | private $children; |
||
51 | |||
52 | /** |
||
53 | * @var Feature |
||
54 | * |
||
55 | * @ORM\ManyToOne(targetEntity="Feature", inversedBy="children", cascade={"persist", "remove"}) |
||
56 | */ |
||
57 | private $parent; |
||
58 | |||
59 | 10 | public function __construct() |
|
60 | { |
||
61 | 10 | $this->children = new \Doctrine\Common\Collections\ArrayCollection(); |
|
0 ignored issues
–
show
|
|||
62 | 10 | $this->enabled = false; |
|
63 | 10 | } |
|
64 | |||
65 | public function __toString() |
||
66 | { |
||
67 | return $this->getName(); |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * Get id. |
||
72 | * |
||
73 | * @return int |
||
74 | */ |
||
75 | public function getId() |
||
76 | { |
||
77 | return $this->id; |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * Set parent. |
||
82 | * |
||
83 | * @param Ae\FeatureBundle\Entity\Feature $parent |
||
84 | */ |
||
85 | 5 | public function setParent(\Ae\FeatureBundle\Entity\Feature $parent) |
|
86 | { |
||
87 | 5 | $this->parent = $parent; |
|
88 | 5 | } |
|
89 | |||
90 | /** |
||
91 | * Get parent. |
||
92 | * |
||
93 | * @return mixed |
||
94 | */ |
||
95 | 7 | public function getParent() |
|
96 | { |
||
97 | 7 | return $this->parent; |
|
98 | } |
||
99 | |||
100 | /** |
||
101 | * Set name. |
||
102 | * |
||
103 | * @param string $name |
||
104 | */ |
||
105 | 1 | public function setName($name) |
|
106 | { |
||
107 | 1 | $this->name = $name; |
|
108 | 1 | } |
|
109 | |||
110 | /** |
||
111 | * Get name. |
||
112 | * |
||
113 | * @return string |
||
114 | */ |
||
115 | 1 | public function getName() |
|
116 | { |
||
117 | 1 | return $this->name; |
|
118 | } |
||
119 | |||
120 | /** |
||
121 | * Set enabled. |
||
122 | * |
||
123 | * @param bool $enabled |
||
124 | */ |
||
125 | 3 | public function setEnabled($enabled) |
|
126 | { |
||
127 | 3 | $this->enabled = $enabled; |
|
128 | 3 | } |
|
129 | |||
130 | /** |
||
131 | * Get enabled. |
||
132 | * |
||
133 | * @return bool |
||
134 | */ |
||
135 | 4 | public function getEnabled() |
|
136 | { |
||
137 | 4 | return $this->enabled; |
|
138 | } |
||
139 | |||
140 | /** |
||
141 | * Set role. |
||
142 | * |
||
143 | * @param text $role |
||
144 | */ |
||
145 | 1 | public function setRole($role) |
|
146 | { |
||
147 | 1 | $this->role = $role; |
|
0 ignored issues
–
show
It seems like
$role of type object<Ae\FeatureBundle\Entity\text> is incompatible with the declared type string of property $role .
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.. ![]() |
|||
148 | 1 | } |
|
149 | |||
150 | /** |
||
151 | * Get role. |
||
152 | * |
||
153 | * @return text |
||
154 | */ |
||
155 | 1 | public function getRole() |
|
156 | { |
||
157 | 1 | return $this->role; |
|
158 | } |
||
159 | |||
160 | 2 | public function getParentRole() |
|
161 | { |
||
162 | 2 | return $this->getParent() ? $this->getParent()->getRole() : null; |
|
163 | } |
||
164 | |||
165 | /** |
||
166 | * Add children. |
||
167 | * |
||
168 | * @param Ae\FeatureBundle\Entity\Feature $children |
||
169 | */ |
||
170 | 1 | public function addFeature(\Ae\FeatureBundle\Entity\Feature $children) |
|
171 | { |
||
172 | 1 | $this->children[] = $children; |
|
173 | 1 | } |
|
174 | |||
175 | /** |
||
176 | * Get children. |
||
177 | * |
||
178 | * @return Doctrine\Common\Collections\Collection |
||
179 | */ |
||
180 | 1 | public function getChildren() |
|
181 | { |
||
182 | 1 | return $this->children; |
|
183 | } |
||
184 | |||
185 | 4 | public function isEnabled() |
|
186 | { |
||
187 | 4 | return $this->getEnabled() && ($this->getParent() ? $this->getParent()->getEnabled() : true); |
|
188 | } |
||
189 | } |
||
190 |
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..