Skip to content

Commit c979a7d

Browse files
committed
fix(AppFramework): Adjust types so PHPStan understands them
Signed-off-by: provokateurin <kate@provokateurin.de>
1 parent dc63c92 commit c979a7d

21 files changed

+27
-33
lines changed

lib/private/AppFramework/OCS/BaseResponse.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
use OCP\AppFramework\Http\Response;
1212

1313
/**
14-
* @psalm-import-type DataResponseType from DataResponse
1514
* @template S of Http::STATUS_*
16-
* @template-covariant T of DataResponseType
17-
* @template H of array<string, mixed>
15+
* @template-covariant T of array|int|float|string|bool|object|null|\stdClass|\JsonSerializable
16+
* @template-covariant H of array<string, mixed>
1817
* @template-extends Response<Http::STATUS_*, array<string, mixed>>
1918
*/
2019
abstract class BaseResponse extends Response {

lib/private/AppFramework/OCS/V1Response.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
namespace OC\AppFramework\OCS;
88

99
use OCP\AppFramework\Http;
10-
use OCP\AppFramework\Http\DataResponse;
1110
use OCP\AppFramework\OCSController;
1211

1312
/**
14-
* @psalm-import-type DataResponseType from DataResponse
1513
* @template S of Http::STATUS_*
16-
* @template-covariant T of DataResponseType
17-
* @template H of array<string, mixed>
18-
* @template-extends BaseResponse<Http::STATUS_*, DataResponseType, array<string, mixed>>
14+
* @template-covariant T of array|int|float|string|bool|object|null|\stdClass|\JsonSerializable
15+
* @template-covariant H of array<string, mixed>
16+
* @template-extends BaseResponse<Http::STATUS_*, array|int|float|string|bool|object|null|\stdClass|\JsonSerializable, array<string, mixed>>
1917
*/
2018
class V1Response extends BaseResponse {
2119
/**

lib/private/AppFramework/OCS/V2Response.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
namespace OC\AppFramework\OCS;
88

99
use OCP\AppFramework\Http;
10-
use OCP\AppFramework\Http\DataResponse;
1110
use OCP\AppFramework\OCSController;
1211

1312
/**
14-
* @psalm-import-type DataResponseType from DataResponse
1513
* @template S of Http::STATUS_*
16-
* @template-covariant T of DataResponseType
17-
* @template H of array<string, mixed>
18-
* @template-extends BaseResponse<Http::STATUS_*, DataResponseType, array<string, mixed>>
14+
* @template-covariant T of array|int|float|string|bool|object|null|\stdClass|\JsonSerializable
15+
* @template-covariant H of array<string, mixed>
16+
* @template-extends BaseResponse<Http::STATUS_*, array|int|float|string|bool|object|null|\stdClass|\JsonSerializable, array<string, mixed>>
1917
*/
2018
class V2Response extends BaseResponse {
2119
/**

lib/public/AppFramework/Http/DataDisplayResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @since 8.1.0
1616
* @template S of Http::STATUS_*
17-
* @template H of array<string, mixed>
17+
* @template-covariant H of array<string, mixed>
1818
* @template-extends Response<Http::STATUS_*, array<string, mixed>>
1919
*/
2020
class DataDisplayResponse extends Response {

lib/public/AppFramework/Http/DataDownloadResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* @since 8.0.0
1616
* @template S of Http::STATUS_*
1717
* @template C of string
18-
* @template H of array<string, mixed>
18+
* @template-covariant H of array<string, mixed>
1919
* @template-extends DownloadResponse<Http::STATUS_*, string, array<string, mixed>>
2020
*/
2121
class DataDownloadResponse extends DownloadResponse {

lib/public/AppFramework/Http/DataResponse.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
* A generic DataResponse class that is used to return generic data responses
1414
* for responders to transform
1515
* @since 8.0.0
16-
* @psalm-type DataResponseType = array|int|float|string|bool|object|null|\stdClass|\JsonSerializable
1716
* @template S of Http::STATUS_*
18-
* @template-covariant T of DataResponseType
19-
* @template H of array<string, mixed>
17+
* @template-covariant T of array|int|float|string|bool|object|null|\stdClass|\JsonSerializable
18+
* @template-covariant H of array<string, mixed>
2019
* @template-extends Response<Http::STATUS_*, array<string, mixed>>
2120
*/
2221
class DataResponse extends Response {

lib/public/AppFramework/Http/DownloadResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @since 7.0.0
1515
* @template S of Http::STATUS_*
1616
* @template C of string
17-
* @template H of array<string, mixed>
17+
* @template-covariant H of array<string, mixed>
1818
* @template-extends Response<Http::STATUS_*, array<string, mixed>>
1919
*/
2020
class DownloadResponse extends Response {

lib/public/AppFramework/Http/FileDisplayResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* @since 11.0.0
1717
* @template S of Http::STATUS_*
18-
* @template H of array<string, mixed>
18+
* @template-covariant H of array<string, mixed>
1919
* @template-extends Response<Http::STATUS_*, array<string, mixed>>
2020
*/
2121
class FileDisplayResponse extends Response implements ICallbackResponse {

lib/public/AppFramework/Http/JSONResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @since 6.0.0
1515
* @template S of Http::STATUS_*
1616
* @template-covariant T of null|string|int|float|bool|array|\stdClass|\JsonSerializable
17-
* @template H of array<string, mixed>
17+
* @template-covariant H of array<string, mixed>
1818
* @template-extends Response<Http::STATUS_*, array<string, mixed>>
1919
*/
2020
class JSONResponse extends Response {

lib/public/AppFramework/Http/NotFoundResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* A generic 404 response showing an 404 error page as well to the end-user
1414
* @since 8.1.0
1515
* @template S of Http::STATUS_*
16-
* @template H of array<string, mixed>
16+
* @template-covariant H of array<string, mixed>
1717
* @template-extends TemplateResponse<Http::STATUS_*, array<string, mixed>>
1818
*/
1919
class NotFoundResponse extends TemplateResponse {

0 commit comments

Comments
 (0)