Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
romalytvynenko authored and github-actions[bot] committed Apr 7, 2024
1 parent 7f8748e commit 9a9d139
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/Infer/Handler/IndexBuildingHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class IndexBuildingHandler
{
public function __construct(
private array $indexBuilders,
){}
) {
}

public function shouldHandle($node)
{
Expand Down
1 change: 1 addition & 0 deletions src/Support/Generator/Parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Parameter

/**
* Possible values are "query", "header", "path" or "cookie".
*
* @var "query"|"header"|"path"|"cookie".
*/
public string $in;
Expand Down
3 changes: 2 additions & 1 deletion src/Support/IndexBuilders/Bag.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class Bag
{
public function __construct(
public array $data = []
) {}
) {
}

public function set(string $key, $value)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Support/IndexBuilders/RequestParametersBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,29 +110,29 @@ private function makeFloatParameter(Scope $scope, Node $node)
{
return [
new FloatType,
TypeHelper::getArgType($scope, $node->args, ['default', 1], new LiteralFloatType(0))->value ?? null
TypeHelper::getArgType($scope, $node->args, ['default', 1], new LiteralFloatType(0))->value ?? null,
];
}

private function makeBooleanParameter(Scope $scope, Node $node)
{
return [
new BooleanType,
TypeHelper::getArgType($scope, $node->args, ['default', 1], new LiteralBooleanType(false))->value ?? null
TypeHelper::getArgType($scope, $node->args, ['default', 1], new LiteralBooleanType(false))->value ?? null,
];
}

private function makeStringParameter(Scope $scope, Node $node)
{
return [
new StringType,
TypeHelper::getArgType($scope, $node->args, ['default', 1])->value ?? null
TypeHelper::getArgType($scope, $node->args, ['default', 1])->value ?? null,
];
}

private function makeEnumParameter(Scope $scope, Node $node)
{
if (!$className = TypeHelper::getArgType($scope, $node->args, ['default', 1])->value ?? null) {
if (! $className = TypeHelper::getArgType($scope, $node->args, ['default', 1])->value ?? null) {
return [null, null];
}

Expand Down
14 changes: 7 additions & 7 deletions tests/Support/OperationExtensions/RequestBodyExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function index(Illuminate\Http\Request $request)
->toHaveLength(1)
->and($properties['status'])
->toBe([
'$ref' => '#/components/schemas/RequestBodyExtensionTest__Status_Params_Extraction'
'$ref' => '#/components/schemas/RequestBodyExtensionTest__Status_Params_Extraction',
])
->and($openApiDocument['components']['schemas']['RequestBodyExtensionTest__Status_Params_Extraction'])
->toBe([
Expand All @@ -146,26 +146,26 @@ public function index(Illuminate\Http\Request $request)
'hearts',
'spades',
],
'title' => 'RequestBodyExtensionTest__Status_Params_Extraction'
]);
'title' => 'RequestBodyExtensionTest__Status_Params_Extraction',
]);
});
class RequestBodyExtensionTest__extracts_parameters_from_retrieving_methods_with_enum
{
public function index(Illuminate\Http\Request $request)
{
$request->enum('status', RequestBodyExtensionTest__Status_Params_Extraction::class);

// $request->query('in_query');
// $request->query('in_query');
}
}
enum RequestBodyExtensionTest__Status_Params_Extraction: string {
enum RequestBodyExtensionTest__Status_Params_Extraction: string
{
case Clubs = 'clubs';
case Diamonds = 'diamonds';
case Hearts = 'hearts';
case Spades = 'spades';
}


it('extracts parameters, their defaults, and descriptions from calling request parameters retrieving methods with query', function () {
$openApiDocument = generateForRoute(function () {
return RouteFacade::post('api/test', [RequestBodyExtensionTest__extracts_parameters_from_retrieving_methods_with_query::class, 'index']);
Expand All @@ -180,7 +180,7 @@ enum RequestBodyExtensionTest__Status_Params_Extraction: string {
'type' => 'string',
],
'default' => 'foo',
]]);
]]);
});
class RequestBodyExtensionTest__extracts_parameters_from_retrieving_methods_with_query
{
Expand Down

0 comments on commit 9a9d139

Please sign in to comment.