Skip to content

Commit

Permalink
style: fix (updated) code style
Browse files Browse the repository at this point in the history
  • Loading branch information
JaZo committed Oct 10, 2024
1 parent b217800 commit a20b160
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/Builders/Paths/Operation/RequestBodyBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class RequestBodyBuilder extends Builder

public function __construct(
Generator $generator,
SchemaBuilder $schemaBuilder
SchemaBuilder $schemaBuilder,
) {
parent::__construct($generator);
$this->schemaBuilder = $schemaBuilder;
Expand Down
8 changes: 4 additions & 4 deletions src/Builders/Paths/Operation/ResponseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ResponseBuilder extends Builder
public function __construct(
Generator $generator,
ComponentsContainer $components,
SchemaBuilder $schemaBuilder
SchemaBuilder $schemaBuilder,
) {
parent::__construct($generator);
$this->components = $components;
Expand Down Expand Up @@ -74,7 +74,7 @@ public function build(Route $route): array
public static function buildResponse(
SchemaContract $data,
?Schema $meta = null,
?Schema $links = null
?Schema $links = null,
): Schema {
$jsonapi = Schema::object('jsonapi')
->properties(Schema::string('version')
Expand All @@ -95,8 +95,8 @@ public static function buildResponse(
*
* @return \LaravelJsonApi\OpenApiSpec\Descriptors\Actions\ActionDescriptor|null
*/
protected function getDescriptor(Route $route
): ?Responses\ResponseDescriptor {
protected function getDescriptor(Route $route): ?Responses\ResponseDescriptor
{
$class = $this->descriptorClass($route);
if (isset($this->descriptors[$class])) {
return new $this->descriptors[$class](
Expand Down
8 changes: 4 additions & 4 deletions src/Builders/Paths/Operation/SchemaBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SchemaBuilder extends Builder
*/
public function __construct(
Generator $generator,
ComponentsContainer $components
ComponentsContainer $components,
) {
parent::__construct($generator);
$this->components = $components;
Expand Down Expand Up @@ -71,7 +71,7 @@ public function build(Route $route, bool $isRequest = false): SchemaContract
protected function buildResponseSchema(
Route $route,
SchemaDescriptorContract $descriptor,
string $objectId
string $objectId,
): SchemaContract {
$method = $route->action();

Expand Down Expand Up @@ -144,7 +144,7 @@ protected function buildResponseSchema(
protected function buildRequestSchema(
Route $route,
SchemaDescriptorContract $descriptor,
string $objectId
string $objectId,
): SchemaContract {
$method = $route->action();
if ($route->isRelation()) {
Expand Down Expand Up @@ -185,7 +185,7 @@ protected function buildRequestSchema(
*/
public static function objectId(
Route $route,
bool $isRequest = false
bool $isRequest = false,
): string {
if ($isRequest) {
$method = $route->action();
Expand Down
2 changes: 1 addition & 1 deletion src/Builders/Paths/OperationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class OperationBuilder extends Builder

public function __construct(
Generator $generator,
ComponentsContainer $components
ComponentsContainer $components,
) {
parent::__construct($generator);
$this->components = $components;
Expand Down
5 changes: 2 additions & 3 deletions src/Builders/PathsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PathsBuilder extends Builder

public function __construct(
Generator $generator,
ComponentsContainer $components
ComponentsContainer $components,
) {
parent::__construct($generator);
$this->components = $components;
Expand All @@ -36,8 +36,7 @@ public function build(): array
fn (IlluminateRoute $route) => SpecRoute::belongsTo($route,
$this->generator->server())
)
->map(fn (IlluminateRoute $route
) => new SpecRoute($this->generator->server(), $route))
->map(fn (IlluminateRoute $route) => new SpecRoute($this->generator->server(), $route))
->mapToGroups(function (SpecRoute $route) {
return [$route->uri() => $route];
})
Expand Down
2 changes: 1 addition & 1 deletion src/Descriptors/Actions/ActionDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(
RequestBodyBuilder $requestBodyBuilder,
ResponseBuilder $responseBuilder,
Generator $generator,
Route $route
Route $route,
) {
$this->parameterBuilder = $parameterBuilder;
$this->requestBodyBuilder = $requestBodyBuilder;
Expand Down
2 changes: 1 addition & 1 deletion src/Descriptors/Requests/RequestDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ abstract class RequestDescriptor extends Descriptor implements RequestDescriptor
public function __construct(
Generator $generator,
Route $route,
SchemaBuilder $schemaBuilder
SchemaBuilder $schemaBuilder,
) {
parent::__construct($generator);
$this->route = $route;
Expand Down
2 changes: 1 addition & 1 deletion src/Descriptors/Responses/ResponseDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(
Generator $generator,
Route $route,
SchemaBuilder $schemaBuilder,
Collection $defaults
Collection $defaults,
) {
parent::__construct($generator);
$this->route = $route;
Expand Down
20 changes: 10 additions & 10 deletions src/Descriptors/Schema/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function fetch(
JASchema $schema,
string $objectId,
string $type,
string $name
string $name,
): OASchema {
$resource = $this->generator
->resources()
Expand Down Expand Up @@ -225,7 +225,7 @@ public function detachRelationship(Route $route): OASchema
*/
public function fetchPolymorphicRelationship(
Route $route,
$objectId
$objectId,
): OASchema {
$resource = $this->generator->resources()
->resource($route->schema()::model());
Expand Down Expand Up @@ -342,7 +342,7 @@ public function filters($route): array
*/
protected function fields(
array $fields,
JsonApiResource $resource
JsonApiResource $resource,
): Collection {
return collect($fields)
->mapToGroups(function (Field $field) {
Expand Down Expand Up @@ -376,7 +376,7 @@ protected function fields(
*/
protected function attributes(
Collection $fields,
JsonApiResource $example
JsonApiResource $example,
): array {
return $fields
->filter(fn ($field) => !($field instanceof ID))
Expand Down Expand Up @@ -424,7 +424,7 @@ protected function attributes(
*/
protected function relationships(
Collection $relationships,
JsonApiResource $example
JsonApiResource $example,
): array {
return $relationships
->map(function (Relation $relation) use ($example) {
Expand All @@ -444,7 +444,7 @@ protected function relationships(
protected function relationship(
Relation $relation,
JsonApiResource $example,
bool $includeData = false
bool $includeData = false,
): OASchema {
$fieldId = $relation->name();

Expand Down Expand Up @@ -480,7 +480,7 @@ protected function relationship(
protected function relationshipData(
Relation $relation,
JsonApiResource $example,
string $type
string $type,
): OASchema {
if ($relation instanceof PolymorphicRelation) {
// @todo Add examples for each available type
Expand Down Expand Up @@ -521,7 +521,7 @@ protected function relationshipData(
public function relationshipLinks(
$relation,
JsonApiResource $example,
string $type
string $type,
): OASchema {
$name = Str::dasherize(
Str::plural($relation->relationName())
Expand Down Expand Up @@ -578,8 +578,8 @@ protected function links(Route $route, JsonApiResource $resource): array
/**
* @todo Get descriptors from Attributes
*/
protected function getDescriptor(Eloquent\Contracts\Filter $filter
): string {
protected function getDescriptor(Eloquent\Contracts\Filter $filter): string
{
foreach ($this->filterDescriptors as $filterClass => $descriptor) {
if ($filter instanceof $filterClass) {
return $descriptor;
Expand Down
2 changes: 1 addition & 1 deletion src/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public function action(): string

public static function belongsTo(
IlluminateRoute $route,
Server $server
Server $server,
): bool {
return Str::contains(
$route->getName(),
Expand Down

0 comments on commit a20b160

Please sign in to comment.