Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable28] Add the new keyword #12229

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading