Skip to content

Commit 97c0975

Browse files
committed
fix(AppFramework): Adjust types so PHPStan understands them
Signed-off-by: provokateurin <[email protected]>
1 parent 431a37e commit 97c0975

21 files changed

+48
-56
lines changed

lib/private/AppFramework/OCS/BaseResponse.php

Lines changed: 3 additions & 4 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
15-
* @template S of Http::STATUS_*
16-
* @template-covariant T of DataResponseType
17-
* @template H of array<string, mixed>
14+
* @template-covariant S of Http::STATUS_*
15+
* @template-covariant T of mixed
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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@
99
namespace OC\AppFramework\OCS;
1010

1111
use OCP\AppFramework\Http;
12-
use OCP\AppFramework\Http\DataResponse;
1312
use OCP\AppFramework\OCSController;
1413

1514
/**
16-
* @psalm-import-type DataResponseType from DataResponse
17-
* @template S of Http::STATUS_*
18-
* @template-covariant T of DataResponseType
19-
* @template H of array<string, mixed>
20-
* @template-extends BaseResponse<Http::STATUS_*, DataResponseType, array<string, mixed>>
15+
* @template-covariant S of Http::STATUS_*
16+
* @template-covariant H of array<string, mixed>
17+
* @template-extends BaseResponse<Http::STATUS_*, mixed, array<string, mixed>>
2118
*/
2219
class V1Response extends BaseResponse {
2320
/**

lib/private/AppFramework/OCS/V2Response.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@
99
namespace OC\AppFramework\OCS;
1010

1111
use OCP\AppFramework\Http;
12-
use OCP\AppFramework\Http\DataResponse;
1312
use OCP\AppFramework\OCSController;
1413

1514
/**
16-
* @psalm-import-type DataResponseType from DataResponse
17-
* @template S of Http::STATUS_*
18-
* @template-covariant T of DataResponseType
19-
* @template H of array<string, mixed>
20-
* @template-extends BaseResponse<Http::STATUS_*, DataResponseType, array<string, mixed>>
15+
* @template-covariant S of Http::STATUS_*
16+
* @template-covariant H of array<string, mixed>
17+
* @template-extends BaseResponse<Http::STATUS_*, mixed, array<string, mixed>>
2118
*/
2219
class V2Response extends BaseResponse {
2320
/**

lib/public/AppFramework/Http/DataDisplayResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
* Class DataDisplayResponse
1414
*
1515
* @since 8.1.0
16-
* @template S of Http::STATUS_*
17-
* @template H of array<string, mixed>
16+
* @template-covariant S of Http::STATUS_*
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
* Class DataDownloadResponse
1414
*
1515
* @since 8.0.0
16-
* @template S of Http::STATUS_*
17-
* @template C of string
18-
* @template H of array<string, mixed>
16+
* @template-covariant S of Http::STATUS_*
17+
* @template-covariant C of string
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: 3 additions & 4 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
17-
* @template S of Http::STATUS_*
18-
* @template-covariant T of DataResponseType
19-
* @template H of array<string, mixed>
16+
* @template-covariant S of Http::STATUS_*
17+
* @template-covariant T of mixed
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
/**
1313
* Prompts the user to download the a file
1414
* @since 7.0.0
15-
* @template S of Http::STATUS_*
16-
* @template C of string
17-
* @template H of array<string, mixed>
15+
* @template-covariant S of Http::STATUS_*
16+
* @template-covariant C of string
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* Class FileDisplayResponse
1515
*
1616
* @since 11.0.0
17-
* @template S of Http::STATUS_*
18-
* @template H of array<string, mixed>
17+
* @template-covariant S of Http::STATUS_*
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
/**
1313
* A renderer for JSON calls
1414
* @since 6.0.0
15-
* @template S of Http::STATUS_*
15+
* @template-covariant 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
/**
1313
* A generic 404 response showing an 404 error page as well to the end-user
1414
* @since 8.1.0
15-
* @template S of Http::STATUS_*
16-
* @template H of array<string, mixed>
15+
* @template-covariant S of Http::STATUS_*
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)