Skip to content

Commit

Permalink
Fixed code style
Browse files Browse the repository at this point in the history
  • Loading branch information
tabuna authored and github-actions[bot] committed Oct 8, 2024
1 parent 6b76d44 commit 736293f
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function handle(string $content = '')
$parser = new Parser($content);

if ($this->checkBatchSizeWithinLimit($parser->countBatchingRequests())) {
return $this->makeResponse(new MaxBatchSizeExceededException());
return $this->makeResponse(new MaxBatchSizeExceededException);
}

$result = collect($parser->makeRequests())
Expand Down Expand Up @@ -110,7 +110,7 @@ public function handleProcedure(Request $request, bool $notification): Response
$procedure = $this->findProcedure($request);

if ($procedure === null) {
return $this->makeResponse(new MethodNotFound(), $request);
return $this->makeResponse(new MethodNotFound, $request);
}

$result = $notification
Expand Down
4 changes: 2 additions & 2 deletions src/Docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function getAnnotations(): Collection
*/
private function getMethodAnnotations(ReflectionMethod $method, string $class): array
{
$repository = new Repository();
$repository = new Repository;

$values = $this
->getAnnotationsFrom($method, $class)
Expand All @@ -117,7 +117,7 @@ private function getMethodAnnotations(ReflectionMethod $method, string $class):
*/
private function getAnnotationsFrom(ReflectionMethod $method, string $class): Collection
{
$annotations = (new AnnotationReader())->getMethodAnnotations($method);
$annotations = (new AnnotationReader)->getMethodAnnotations($method);

return collect($annotations)->filter(fn ($annotation) => is_a($annotation, $class));
}
Expand Down
2 changes: 1 addition & 1 deletion src/HandleProcedure.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected function handleException(Throwable $exception)
: $exception->getCode();

if ($code === 500) {
return new InternalErrorException();
return new InternalErrorException;
}

if (! is_int($code)) {
Expand Down
6 changes: 3 additions & 3 deletions src/Http/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ public function countBatchingRequests(): int
public function checkValidation($options = [])
{
if ($this->isError()) {
return new ParseErrorException();
return new ParseErrorException;
}

if (! is_array($options) || Arr::isList($options)) {
return new InvalidRequestException();
return new InvalidRequestException;
}

$data = $options;
Expand Down Expand Up @@ -179,7 +179,7 @@ public static function rules(): array
'jsonrpc' => 'required|in:"2.0"',
'method' => 'required|string',
'params' => 'array',
'id' => new Identifier(),
'id' => new Identifier,
];
}
}
2 changes: 1 addition & 1 deletion src/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct()
*/
public static function loadArray(array $collection): Request
{
$request = new static();
$request = new static;
$methods = get_class_methods($request);

collect($collection)
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ class Response implements JsonSerializable
*/
public static function makeFromResult($result, ?Request $request = null): self
{
$request ??= new Request();
$request ??= new Request;

return tap(
new self(),
new self,
fn (Response $response) => $response->setId($request->getId())
->setVersion($request->getVersion())
->setResult($result)
Expand Down
4 changes: 2 additions & 2 deletions tests/FixtureProcedure.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function ok(): string

public function runtimeError()
{
throw new RuntimeRpcException();
throw new RuntimeRpcException;
}

public function invalidRequestException()
Expand All @@ -108,7 +108,7 @@ public function reportException(): mixed
*/
public function renderException(): mixed
{
throw new RenderResponseException();
throw new RenderResponseException;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/AppTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function testExtendsProcedure(): void

public function testFindMethodProcedure(): void
{
$request = tap(new Request(), static function (Request $request) {
$request = tap(new Request, static function (Request $request) {
$request->setId(1);
$request->setMethod('fixture@subtract');
$request->setParams([42, 23]);
Expand All @@ -64,7 +64,7 @@ public function testFindMethodProcedure(): void

public function testNotFoundMethodProcedure(): void
{
$request = tap(new Request(), static function (Request $request) {
$request = tap(new Request, static function (Request $request) {
$request->setId(1);
$request->setMethod('notFoundMethod');
$request->setParams([42, 23]);
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class RequestTest extends TestCase
{
public function testFillableRequest(): void
{
$request = tap(new Request(), static function (Request $request) {
$request = tap(new Request, static function (Request $request) {
$request->setId(1);
$request->setMethod('subtract');
$request->setParams([42, 23]);
Expand All @@ -26,7 +26,7 @@ public function testFillableRequest(): void

public function testRevertRequest(): void
{
$request = tap(new Request(), static function (Request $request) {
$request = tap(new Request, static function (Request $request) {
$request->setId(1);
$request->setMethod('subtract');
$request->setParams([42, 23]);
Expand Down

0 comments on commit 736293f

Please sign in to comment.