Skip to content

Commit bc5b42d

Browse files
chore: stop using deprecated class OC_OCS_Result (#1228)
1 parent eccb8c6 commit bc5b42d

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

lib/Api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public static function get() {
6666
}
6767

6868
/* @phan-suppress-next-line PhanDeprecatedClass */
69-
return new \OC_OCS_Result($entries);
69+
return new \OC\OCS\Result($entries);
7070
}
7171

7272
/**

lib/Controller/EndPoint.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ public function getFilter($filter) {
7070
}
7171

7272
/**
73-
* @param \OC_OCS_Result $ocsResult
73+
* @param \OC\OCS\Result $ocsResult
7474
* @return JSONResponse
7575
*/
76-
protected function ocsToJsonResponse(\OC_OCS_Result $ocsResult) {
76+
protected function ocsToJsonResponse(\OC\OCS\Result $ocsResult) {
7777
$response = new JSONResponse(
7878
[
7979
'ocs' => [

lib/Controller/OCSEndPoint.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ protected function readParameters(array $parameters) {
164164

165165
/**
166166
* @param array $parameters
167-
* @return \OC_OCS_Result
167+
* @return \OC\OCS\Result
168168
*/
169169
public function getDefault(array $parameters) {
170170
return $this->get(\array_merge($parameters, [
@@ -174,25 +174,25 @@ public function getDefault(array $parameters) {
174174

175175
/**
176176
* @param array $parameters
177-
* @return \OC_OCS_Result
177+
* @return \OC\OCS\Result
178178
*/
179179
public function getFilter(array $parameters) {
180180
return $this->get($parameters);
181181
}
182182

183183
/**
184184
* @param array $parameters
185-
* @return \OC_OCS_Result
185+
* @return \OC\OCS\Result
186186
*/
187187
protected function get(array $parameters) {
188188
try {
189189
$this->readParameters($parameters);
190190
} catch (InvalidFilterException $e) {
191191
/* @phan-suppress-next-line PhanDeprecatedClass */
192-
return new \OC_OCS_Result(null, Http::STATUS_NOT_FOUND);
192+
return new \OC\OCS\Result(null, Http::STATUS_NOT_FOUND);
193193
} catch (\OutOfBoundsException $e) {
194194
/* @phan-suppress-next-line PhanDeprecatedClass */
195-
return new \OC_OCS_Result(null, Http::STATUS_FORBIDDEN);
195+
return new \OC\OCS\Result(null, Http::STATUS_FORBIDDEN);
196196
}
197197

198198
try {
@@ -210,17 +210,17 @@ protected function get(array $parameters) {
210210
} catch (\OutOfBoundsException $e) {
211211
// Invalid since argument
212212
/* @phan-suppress-next-line PhanDeprecatedClass */
213-
return new \OC_OCS_Result(null, Http::STATUS_FORBIDDEN);
213+
return new \OC\OCS\Result(null, Http::STATUS_FORBIDDEN);
214214
} catch (\BadMethodCallException $e) {
215215
// No activity settings enabled
216216
/* @phan-suppress-next-line PhanDeprecatedClass */
217-
return new \OC_OCS_Result(null, Http::STATUS_NO_CONTENT);
217+
return new \OC\OCS\Result(null, Http::STATUS_NO_CONTENT);
218218
}
219219

220220
$headers = $this->generateHeaders($response['headers'], $response['has_more']);
221221
if (empty($response['data'])) {
222222
/* @phan-suppress-next-line PhanDeprecatedClass */
223-
return new \OC_OCS_Result([], Http::STATUS_NOT_MODIFIED, null, $headers);
223+
return new \OC\OCS\Result([], Http::STATUS_NOT_MODIFIED, null, $headers);
224224
}
225225

226226
$preparedActivities = [];
@@ -248,7 +248,7 @@ protected function get(array $parameters) {
248248
}
249249

250250
/* @phan-suppress-next-line PhanDeprecatedClass */
251-
return new \OC_OCS_Result($preparedActivities, 100, null, $headers);
251+
return new \OC\OCS\Result($preparedActivities, 100, null, $headers);
252252
}
253253

254254
/**

tests/unit/Controller/OCSEndPointTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,10 +418,10 @@ public function testGetInvalid($readParamsThrows, $dataGetThrows, $expected) {
418418
->method('generateHeaders');
419419
}
420420

421-
/** @var \OC_OCS_Result $result */
421+
/** @var \OC\OCS\Result $result */
422422
$result = $this->invokePrivate($controller, 'get', [[]]);
423423

424-
$this->assertInstanceOf('\OC_OCS_Result', $result);
424+
$this->assertInstanceOf('\OC\OCS\Result', $result);
425425
$this->assertSame($expected, $result->getStatusCode());
426426
}
427427

@@ -477,10 +477,10 @@ public function testGet($time, $objectType, $objectId, array $additionalArgs, $l
477477
'has_more' => false,
478478
]);
479479

480-
/** @var \OC_OCS_Result $result */
480+
/** @var \OC\OCS\Result $result */
481481
$result = $this->invokePrivate($controller, 'get', [[]]);
482482

483-
$this->assertInstanceOf('\OC_OCS_Result', $result);
483+
$this->assertInstanceOf('\OC\OCS\Result', $result);
484484
$this->assertSame(100, $result->getStatusCode());
485485
$this->assertSame([
486486
$expected,

0 commit comments

Comments
 (0)