Skip to content

Commit 1d192e5

Browse files
committed
fix: add deprecation for inline validation - should use formRquests instead
1 parent 61027b3 commit 1d192e5

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/Http/Api/Contracts/HasBatchActions.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,17 @@ protected function handleBatchStoreOrUpdateResponse(Collection $items)
193193
return $this->respondWithResource($this->getResourceCollection(), $items, 200);
194194
}
195195

196+
/**
197+
* @deprecated use your FormRequest instead
198+
*/
196199
protected function rulesForBatchCreate(): array
197200
{
198201
return [];
199202
}
200203

204+
/**
205+
* @deprecated use your FormRequest instead
206+
*/
201207
protected function rulesForBatchUpdate(): array
202208
{
203209
return [];

src/Http/Api/Contracts/HasResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function setStatusCode(int $statusCode): self
3030
*/
3131
protected function respondWithOne($item, ?int $code = null, array $headers = [])
3232
{
33-
return $this->respondWithResource($this->/** @scrutinizer ignore-call */getResourceSingle(), $item, $code, $headers);
33+
return $this->respondWithResource($this->getResourceSingle(), $item, $code, $headers);
3434
}
3535

3636
/**
@@ -44,7 +44,7 @@ protected function respondWithOne($item, ?int $code = null, array $headers = [])
4444
*/
4545
protected function respondWithMany($items, $code = null, $headers = [])
4646
{
47-
return $this->respondWithResource($this->/** @scrutinizer ignore-call */getResourceCollection(), $items, $code, $headers);
47+
return $this->respondWithResource($this->getResourceCollection(), $items, $code, $headers);
4848
}
4949

5050
/**

src/Http/Api/Contracts/HasValidation.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22

33
namespace Phpsa\LaravelApiController\Http\Api\Contracts;
44

5-
65
use Phpsa\LaravelApiController\Exceptions\ApiException;
76

8-
97
trait HasValidation
108
{
119

1210
/**
1311
* Get the validation rules for create.
1412
*
13+
* @deprecated use FormRequest instead
1514
* @return array
1615
*/
1716
protected function rulesForCreate(): array
@@ -22,11 +21,11 @@ protected function rulesForCreate(): array
2221
/**
2322
* Get the validation rules for update.
2423
*
25-
* @param int $id
26-
*
24+
* @param int|string $id
25+
* @depreacted use FormRquest instead
2726
* @return array
2827
*/
29-
protected function rulesForUpdate(/* @scrutinizer ignore-unused */$id): array
28+
protected function rulesForUpdate($id): array
3029
{
3130
return [];
3231
}

0 commit comments

Comments
 (0)