Skip to content

Commit f3b36c3

Browse files
committed
udpate php and response trait
1 parent f063f38 commit f3b36c3

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "This is a simple package containing a simple trait for json response with specific formate.",
44
"license": "MIT",
55
"require": {
6-
"php": ">=5.4",
6+
"php": "^8.1",
77
"illuminate/http": ">=6.0"
88
},
99
"autoload": {

src/ResponseMethods.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
namespace CodeCreeper\Respondo;
44

5+
use Illuminate\Http\JsonResponse;
6+
57
trait ResponseMethods
68
{
7-
protected function sendError($errorMessages = 'Something went wrong, internal server error.', $code = 500, $result = [])
9+
protected function sendError(string $errorMessages = 'Something went wrong, internal server error.', int $code = 500, array $result = []): JsonResponse
810
{
911
$response = [
1012
'metadata' => [
@@ -16,7 +18,7 @@ protected function sendError($errorMessages = 'Something went wrong, internal se
1618
return response()->json($response, $code);
1719
}
1820

19-
protected function sendResponse($result, $message = '', $code = 200)
21+
protected function sendResponse(array $result, string $message = '', int $code = 200): JsonResponse
2022
{
2123
$response = [
2224
'metadata' => [

0 commit comments

Comments
 (0)