@@ -87,7 +87,7 @@ For details take a look at :ref:`OCS <ocscontroller>`.
8787
8888 public function someControllerMethod(): DataResponse {
8989 ...
90- return DataResponse(...);
90+ return new DataResponse(...);
9191 }
9292 }
9393
@@ -155,7 +155,7 @@ If you are working with an existing API where you can not break compatibility, y
155155 */
156156 public function someControllerMethod() {
157157 ...
158- return DataResponse([]);
158+ return new DataResponse([]);
159159 }
160160
161161 .. code-block :: php
@@ -166,23 +166,23 @@ If you are working with an existing API where you can not break compatibility, y
166166 */
167167 public function someControllerMethod() {
168168 ...
169- return DataResponse(null);
169+ return new DataResponse(null);
170170 }
171171
172172 /**
173173 * @return DataResponse<Http::STATUS _OK, \stdClass, array{} >
174174 */
175175 public function someControllerMethod() {
176176 ...
177- return DataResponse(new \stdClass());
177+ return new DataResponse(new \stdClass());
178178 }
179179
180180 /**
181181 * @return DataResponse<Http::STATUS _OK, array <empty >, array{}>
182182 */
183183 public function someControllerMethod() {
184184 ...
185- return DataResponse([]);
185+ return new DataResponse([]);
186186 }
187187
188188 DO NOT throw non-OCS*Exceptions
@@ -232,9 +232,9 @@ All 2xx responses should return the same data structure and all 4xx should also
232232 public function someControllerMethod() {
233233 ...
234234 if (...) {
235- return DataResponse(["name" => name], Http::STATUS_OK);
235+ return new DataResponse(["name" => name], Http::STATUS_OK);
236236 } else {
237- return DataResponse(["id" => id, "name" => name], Http::STATUS_CREATED);
237+ return new DataResponse(["id" => id, "name" => name], Http::STATUS_CREATED);
238238 }
239239 }
240240
@@ -244,9 +244,9 @@ All 2xx responses should return the same data structure and all 4xx should also
244244 public function someControllerMethod() {
245245 ...
246246 if (...) {
247- return DataResponse(["error" => "bad request"], Http::STATUS_BAD_REQUEST);
247+ return new DataResponse(["error" => "bad request"], Http::STATUS_BAD_REQUEST);
248248 } else {
249- return DataResponse(["message" => "forbidden"], Http::STATUS_FORBIDDEN);
249+ return new DataResponse(["message" => "forbidden"], Http::STATUS_FORBIDDEN);
250250 }
251251 }
252252
@@ -260,9 +260,9 @@ All 2xx responses should return the same data structure and all 4xx should also
260260 public function someControllerMethod() {
261261 ...
262262 if (...) {
263- return DataResponse(["id" => id, "name" => name], Http::STATUS_OK);
263+ return new DataResponse(["id" => id, "name" => name], Http::STATUS_OK);
264264 } else {
265- return DataResponse(["id" => id, "name" => name], Http::STATUS_CREATED);
265+ return new DataResponse(["id" => id, "name" => name], Http::STATUS_CREATED);
266266 }
267267 }
268268
@@ -272,9 +272,9 @@ All 2xx responses should return the same data structure and all 4xx should also
272272 public function someControllerMethod() {
273273 ...
274274 if (...) {
275- return DataResponse(["error" => "bad request"], Http::STATUS_BAD_REQUEST);
275+ return new DataResponse(["error" => "bad request"], Http::STATUS_BAD_REQUEST);
276276 } else {
277- return DataResponse(["error" => "forbidden"], Http::STATUS_FORBIDDEN);
277+ return new DataResponse(["error" => "forbidden"], Http::STATUS_FORBIDDEN);
278278 }
279279 }
280280
@@ -391,7 +391,7 @@ There you can explain what the APIs in the controller do or give examples an how
391391 */
392392 public function someControllerMethod(int $id) {
393393 ...
394- return DataResponse(["name" => name], Http::STATUS_CREATED);
394+ return new DataResponse(["name" => name], Http::STATUS_CREATED);
395395 }
396396 }
397397
@@ -414,7 +414,7 @@ There you can explain what the APIs in the controller do or give examples an how
414414 */
415415 public function someControllerMethod(int $id) {
416416 ...
417- return DataResponse(["name" => name], Http::STATUS_CREATED);
417+ return new DataResponse(["name" => name], Http::STATUS_CREATED);
418418 }
419419 }
420420
0 commit comments