This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php declare(strict_types=1); |
||
2 | |||
3 | /** |
||
4 | * This file is part of Packy. |
||
5 | * |
||
6 | * (c) Peter Nijssen |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace AppBundle\Entity; |
||
13 | |||
14 | use Composer\Semver\Comparator; |
||
15 | |||
16 | class Dependency |
||
17 | { |
||
18 | /** |
||
19 | * @var int |
||
20 | */ |
||
21 | private $id; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $rawVersion; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | private $currentVersion; |
||
32 | |||
33 | /** |
||
34 | * @var \DateTime |
||
35 | */ |
||
36 | private $createdAt; |
||
37 | |||
38 | /** |
||
39 | * @var \DateTime |
||
40 | */ |
||
41 | private $updatedAt; |
||
42 | |||
43 | /** |
||
44 | * @var Project |
||
45 | */ |
||
46 | private $project; |
||
47 | |||
48 | /** |
||
49 | * @var Package |
||
50 | */ |
||
51 | private $package; |
||
52 | |||
53 | /** |
||
54 | * Get id. |
||
55 | * |
||
56 | * @return int |
||
57 | */ |
||
58 | public function getId(): int |
||
59 | { |
||
60 | return $this->id; |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Set rawVersion. |
||
65 | * |
||
66 | * @param string $rawVersion |
||
67 | */ |
||
68 | public function setRawVersion(string $rawVersion) |
||
69 | { |
||
70 | $this->rawVersion = $rawVersion; |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * Get rawVersion. |
||
75 | * |
||
76 | * @return string |
||
77 | */ |
||
78 | public function getRawVersion(): string |
||
79 | { |
||
80 | return $this->rawVersion; |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * Set currentVersion. |
||
85 | * |
||
86 | * @param string $currentVersion |
||
87 | */ |
||
88 | public function setCurrentVersion(string $currentVersion) |
||
89 | { |
||
90 | $this->currentVersion = $currentVersion; |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * Get currentVersion. |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | public function getCurrentVersion(): string |
||
99 | { |
||
100 | return $this->currentVersion; |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * Set project. |
||
105 | * |
||
106 | * @param Project $project |
||
107 | */ |
||
108 | public function setProject(Project $project = null) |
||
109 | { |
||
110 | $this->project = $project; |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * Get project. |
||
115 | * |
||
116 | * @return Project |
||
117 | */ |
||
118 | public function getProject(): ?Project |
||
119 | { |
||
120 | return $this->project; |
||
121 | } |
||
122 | |||
123 | /** |
||
124 | * Set package. |
||
125 | * |
||
126 | * @param Package $package |
||
127 | */ |
||
128 | public function setPackage(Package $package = null) |
||
129 | { |
||
130 | $this->package = $package; |
||
131 | } |
||
132 | |||
133 | /** |
||
134 | * Get package. |
||
135 | * |
||
136 | * @return Package |
||
137 | */ |
||
138 | public function getPackage(): ?Package |
||
139 | { |
||
140 | return $this->package; |
||
141 | } |
||
142 | |||
143 | /** |
||
144 | * Get status. |
||
145 | * |
||
146 | * @return string |
||
147 | */ |
||
148 | public function getStatus(): string |
||
149 | { |
||
150 | if (preg_match('/[a-zA-Z]+$/', $this->getRawVersion())) { |
||
151 | return 'unstable'; |
||
152 | } |
||
153 | |||
154 | if (Comparator::greaterThanOrEqualTo($this->getCurrentVersion(), $this->package->getLatestVersion())) { |
||
155 | return 'stable'; |
||
156 | } |
||
157 | |||
158 | return 'outdated'; |
||
159 | } |
||
160 | |||
161 | /** |
||
162 | * Set createdAt. |
||
163 | * |
||
164 | * @param \DateTimeInterface $createdAt |
||
165 | */ |
||
166 | public function setCreatedAt(\DateTimeInterface $createdAt) |
||
167 | { |
||
168 | $this->createdAt = $createdAt; |
||
0 ignored issues
–
show
|
|||
169 | } |
||
170 | |||
171 | /** |
||
172 | * Get createdAt. |
||
173 | * |
||
174 | * @return \DateTimeInterface |
||
175 | */ |
||
176 | public function getCreatedAt(): \DateTimeInterface |
||
177 | { |
||
178 | return $this->createdAt; |
||
179 | } |
||
180 | |||
181 | /** |
||
182 | * Set updatedAt. |
||
183 | * |
||
184 | * @param \DateTimeInterface $updatedAt |
||
185 | */ |
||
186 | public function setUpdatedAt(\DateTimeInterface $updatedAt) |
||
187 | { |
||
188 | $this->updatedAt = $updatedAt; |
||
0 ignored issues
–
show
$updatedAt is of type object<DateTimeInterface> , but the property $updatedAt was declared to be of type object<DateTime> . Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly. Either this assignment is in error or an instanceof check should be added for that assignment. class Alien {}
class Dalek extends Alien {}
class Plot
{
/** @var Dalek */
public $villain;
}
$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
$plot->villain = $alien;
}
![]() |
|||
189 | } |
||
190 | |||
191 | /** |
||
192 | * Get updatedAt. |
||
193 | * |
||
194 | * @return \DateTimeInterface |
||
195 | */ |
||
196 | public function getUpdatedAt(): \DateTimeInterface |
||
197 | { |
||
198 | return $this->updatedAt; |
||
199 | } |
||
200 | } |
||
201 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.