Skip to content

Commit

Permalink
Add the new keyword
Browse files Browse the repository at this point in the history
The new keyword was not present in the return examples. 

Signed-off-by: Baptiste Fotia <[email protected]>
  • Loading branch information
zak39 authored Jul 26, 2024
1 parent b6ca768 commit 55f4781
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions developer_manual/client_apis/OCS/ocs-openapi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ For details take a look at :ref:`OCS <ocscontroller>`.
public function someControllerMethod(): DataResponse {
...
return DataResponse(...);
return new DataResponse(...);
}
}
Expand Down Expand Up @@ -155,7 +155,7 @@ If you are working with an existing API where you can not break compatibility, y
*/
public function someControllerMethod() {
...
return DataResponse([]);
return new DataResponse([]);
}
.. code-block:: php
Expand All @@ -166,23 +166,23 @@ If you are working with an existing API where you can not break compatibility, y
*/
public function someControllerMethod() {
...
return DataResponse(null);
return new DataResponse(null);
}
/**
* @return DataResponse<Http::STATUS_OK, \stdClass, array{}>
*/
public function someControllerMethod() {
...
return DataResponse(new \stdClass());
return new DataResponse(new \stdClass());
}
/**
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
*/
public function someControllerMethod() {
...
return DataResponse([]);
return new DataResponse([]);
}
DO NOT throw non-OCS*Exceptions
Expand Down Expand Up @@ -232,9 +232,9 @@ All 2xx responses should return the same data structure and all 4xx should also
public function someControllerMethod() {
...
if (...) {
return DataResponse(["name" => name], Http::STATUS_OK);
return new DataResponse(["name" => name], Http::STATUS_OK);
} else {
return DataResponse(["id" => id, "name" => name], Http::STATUS_CREATED);
return new DataResponse(["id" => id, "name" => name], Http::STATUS_CREATED);
}
}
Expand All @@ -244,9 +244,9 @@ All 2xx responses should return the same data structure and all 4xx should also
public function someControllerMethod() {
...
if (...) {
return DataResponse(["error" => "bad request"], Http::STATUS_BAD_REQUEST);
return new DataResponse(["error" => "bad request"], Http::STATUS_BAD_REQUEST);
} else {
return DataResponse(["message" => "forbidden"], Http::STATUS_FORBIDDEN);
return new DataResponse(["message" => "forbidden"], Http::STATUS_FORBIDDEN);
}
}
Expand All @@ -260,9 +260,9 @@ All 2xx responses should return the same data structure and all 4xx should also
public function someControllerMethod() {
...
if (...) {
return DataResponse(["id" => id, "name" => name], Http::STATUS_OK);
return new DataResponse(["id" => id, "name" => name], Http::STATUS_OK);
} else {
return DataResponse(["id" => id, "name" => name], Http::STATUS_CREATED);
return new DataResponse(["id" => id, "name" => name], Http::STATUS_CREATED);
}
}
Expand All @@ -272,9 +272,9 @@ All 2xx responses should return the same data structure and all 4xx should also
public function someControllerMethod() {
...
if (...) {
return DataResponse(["error" => "bad request"], Http::STATUS_BAD_REQUEST);
return new DataResponse(["error" => "bad request"], Http::STATUS_BAD_REQUEST);
} else {
return DataResponse(["error" => "forbidden"], Http::STATUS_FORBIDDEN);
return new DataResponse(["error" => "forbidden"], Http::STATUS_FORBIDDEN);
}
}
Expand Down Expand Up @@ -391,7 +391,7 @@ There you can explain what the APIs in the controller do or give examples an how
*/
public function someControllerMethod(int $id) {
...
return DataResponse(["name" => name], Http::STATUS_CREATED);
return new DataResponse(["name" => name], Http::STATUS_CREATED);
}
}
Expand All @@ -414,7 +414,7 @@ There you can explain what the APIs in the controller do or give examples an how
*/
public function someControllerMethod(int $id) {
...
return DataResponse(["name" => name], Http::STATUS_CREATED);
return new DataResponse(["name" => name], Http::STATUS_CREATED);
}
}
Expand Down

0 comments on commit 55f4781

Please sign in to comment.