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 |
||
2 | |||
3 | namespace Robo\Task\Development; |
||
4 | |||
5 | use Robo\Result; |
||
6 | |||
7 | /** |
||
8 | * Publishes new GitHub release. |
||
9 | * |
||
10 | * ``` php |
||
11 | * <?php |
||
12 | * $this->taskGitHubRelease('0.1.0') |
||
13 | * ->uri('consolidation-org/Robo') |
||
14 | * ->description('Add stuff people need.') |
||
15 | * ->change('Fix #123') |
||
16 | * ->change('Add frobulation method to all widgets') |
||
17 | * ->run(); |
||
18 | * ?> |
||
19 | * ``` |
||
20 | */ |
||
21 | class GitHubRelease extends GitHub |
||
22 | { |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $tag; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $name; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $description = ''; |
||
37 | |||
38 | /** |
||
39 | * @var string[] |
||
40 | */ |
||
41 | protected $changes = []; |
||
42 | |||
43 | /** |
||
44 | * @var bool |
||
45 | */ |
||
46 | protected $draft = false; |
||
47 | |||
48 | /** |
||
49 | * @var bool |
||
50 | */ |
||
51 | protected $prerelease = false; |
||
52 | |||
53 | /** |
||
54 | * @var string |
||
55 | */ |
||
56 | protected $comittish = 'master'; |
||
57 | |||
58 | /** |
||
59 | * @param string $tag |
||
60 | */ |
||
61 | public function __construct($tag) |
||
62 | { |
||
63 | $this->tag = $tag; |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * @param string $tag |
||
68 | * |
||
69 | * @return $this |
||
70 | */ |
||
71 | public function tag($tag) |
||
72 | { |
||
73 | $this->tag = $tag; |
||
74 | return $this; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @param bool $draft |
||
79 | * |
||
80 | * @return $this |
||
81 | */ |
||
82 | public function draft($draft) |
||
83 | { |
||
84 | $this->draft = $draft; |
||
85 | return $this; |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * @param string $name |
||
90 | * |
||
91 | * @return $this |
||
92 | */ |
||
93 | public function name($name) |
||
94 | { |
||
95 | $this->name = $name; |
||
96 | return $this; |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * @param string $description |
||
101 | * |
||
102 | * @return $this |
||
103 | */ |
||
104 | public function description($description) |
||
105 | { |
||
106 | $this->description = $description; |
||
107 | return $this; |
||
108 | } |
||
109 | |||
110 | /** |
||
111 | * @param bool $prerelease |
||
112 | * |
||
113 | * @return $this |
||
114 | */ |
||
115 | public function prerelease($prerelease) |
||
116 | { |
||
117 | $this->prerelease = $prerelease; |
||
118 | return $this; |
||
119 | } |
||
120 | |||
121 | /** |
||
122 | * @param string $comittish |
||
123 | * |
||
124 | * @return $this |
||
125 | */ |
||
126 | public function comittish($comittish) |
||
127 | { |
||
128 | $this->comittish = $comittish; |
||
129 | return $this; |
||
130 | } |
||
131 | |||
132 | /** |
||
133 | * @param string $description |
||
134 | * |
||
135 | * @return $this |
||
136 | */ |
||
137 | public function appendDescription($description) |
||
138 | { |
||
139 | if (!empty($this->description)) { |
||
140 | $this->description .= "\n\n"; |
||
141 | } |
||
142 | $this->description .= $description; |
||
143 | return $this; |
||
144 | } |
||
145 | |||
146 | public function changes(array $changes) |
||
147 | { |
||
148 | $this->changes = array_merge($this->changes, $changes); |
||
0 ignored issues
–
show
|
|||
149 | return $this; |
||
150 | } |
||
151 | |||
152 | /** |
||
153 | * @param string $change |
||
154 | * |
||
155 | * @return $this |
||
156 | */ |
||
157 | public function change($change) |
||
158 | { |
||
159 | $this->changes[] = $change; |
||
160 | return $this; |
||
161 | } |
||
162 | |||
163 | /** |
||
164 | * @return string |
||
165 | */ |
||
166 | protected function getBody() |
||
167 | { |
||
168 | $body = $this->description; |
||
169 | if (!empty($this->changes)) { |
||
170 | $changes = array_map( |
||
171 | function ($line) { |
||
172 | return "* $line"; |
||
173 | }, |
||
174 | $this->changes |
||
175 | ); |
||
176 | $changesText = implode("\n", $changes); |
||
177 | $body .= "### Changelog \n\n$changesText"; |
||
178 | } |
||
179 | return $body; |
||
180 | } |
||
181 | |||
182 | /** |
||
183 | * {@inheritdoc} |
||
184 | */ |
||
185 | public function run() |
||
186 | { |
||
187 | $this->printTaskInfo('Releasing {tag}', ['tag' => $this->tag]); |
||
188 | $this->startTimer(); |
||
189 | list($code, $data) = $this->sendRequest( |
||
190 | 'releases', |
||
191 | [ |
||
192 | "tag_name" => $this->tag, |
||
193 | "target_commitish" => $this->comittish, |
||
194 | "name" => $this->name, |
||
195 | "body" => $this->getBody(), |
||
196 | "draft" => $this->draft, |
||
197 | "prerelease" => $this->prerelease |
||
198 | ] |
||
199 | ); |
||
200 | $this->stopTimer(); |
||
201 | |||
202 | return new Result( |
||
203 | $this, |
||
204 | in_array($code, [200, 201]) ? 0 : 1, |
||
205 | isset($data->message) ? $data->message : '', |
||
206 | ['response' => $data, 'time' => $this->getExecutionTime()] |
||
207 | ); |
||
208 | } |
||
209 | } |
||
210 |
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..