Skip to content

Commit 038d2a0

Browse files
committed
CS fixes
1 parent 56fbce2 commit 038d2a0

18 files changed

+51
-22
lines changed

src/Exception/NoPath.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
namespace Vural\OpenAPIFaker\Exception;
66

77
use Exception;
8+
89
use function Safe\sprintf;
910

1011
class NoPath extends Exception
1112
{
1213
protected string $method;
1314
protected string $path;
1415

15-
public static function forPathAndMethod(string $path, string $method) : self
16+
public static function forPathAndMethod(string $path, string $method): self
1617
{
1718
$e = new self(sprintf('OpenAPI spec does not have a path for %s %s', $method, $path));
1819
$e->path = $path;

src/Exception/NoRequest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Vural\OpenAPIFaker\Exception;
66

77
use Exception;
8+
89
use function Safe\sprintf;
910

1011
class NoRequest extends Exception
@@ -13,7 +14,7 @@ class NoRequest extends Exception
1314
protected string $path;
1415
protected string $contentType;
1516

16-
public static function forPathAndMethod(string $path, string $method) : self
17+
public static function forPathAndMethod(string $path, string $method): self
1718
{
1819
$e = new self(sprintf('OpenAPI spec does not have a response for %s %s', $method, $path));
1920
$e->path = $path;
@@ -22,7 +23,7 @@ public static function forPathAndMethod(string $path, string $method) : self
2223
return $e;
2324
}
2425

25-
public static function forPathAndMethodAndContentType(string $path, string $method, string $contentType) : self
26+
public static function forPathAndMethodAndContentType(string $path, string $method, string $contentType): self
2627
{
2728
$e = new self(sprintf('OpenAPI spec does not have a response for %s %s', $method, $path));
2829
$e->path = $path;

src/Exception/NoResponse.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Vural\OpenAPIFaker\Exception;
66

77
use Exception;
8+
89
use function Safe\sprintf;
910

1011
class NoResponse extends Exception
@@ -13,7 +14,7 @@ class NoResponse extends Exception
1314
protected string $path;
1415
protected ?string $statusCode = null;
1516

16-
public static function forPathAndMethod(string $path, string $method) : self
17+
public static function forPathAndMethod(string $path, string $method): self
1718
{
1819
$e = new self(sprintf('OpenAPI spec does not have a response for %s %s', $method, $path));
1920
$e->path = $path;
@@ -22,7 +23,7 @@ public static function forPathAndMethod(string $path, string $method) : self
2223
return $e;
2324
}
2425

25-
public static function forPathAndMethodAndStatusCode(string $path, string $method, string $statusCode) : self
26+
public static function forPathAndMethodAndStatusCode(string $path, string $method, string $statusCode): self
2627
{
2728
$e = new self(sprintf('OpenAPI spec does not have a response for status code %s at %s %s', $statusCode, $method, $path));
2829
$e->path = $path;

src/Exception/NoSchema.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55
namespace Vural\OpenAPIFaker\Exception;
66

77
use Exception;
8+
89
use function Safe\sprintf;
910

1011
class NoSchema extends Exception
1112
{
1213
public string $name;
1314

14-
public static function forZeroComponents() : self
15+
public static function forZeroComponents(): self
1516
{
1617
return new self('OpenAPI spec does not have any components.');
1718
}
1819

19-
public static function forComponentName(string $name) : self
20+
public static function forComponentName(string $name): self
2021
{
2122
return new self(sprintf('OpenAPI spec does not have any component schema named %s.', $name));
2223
}

src/OpenAPIFaker.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Vural\OpenAPIFaker\Exception\NoResponse;
2020
use Vural\OpenAPIFaker\Exception\NoSchema;
2121
use Vural\OpenAPIFaker\SchemaFaker\SchemaFaker;
22+
2223
use function array_key_exists;
2324
use function strtolower;
2425

@@ -35,7 +36,7 @@ private function __construct()
3536
* @throws TypeErrorException
3637
* @throws UnresolvableReferenceException
3738
*/
38-
public static function createFromJson(string $json) : self
39+
public static function createFromJson(string $json): self
3940
{
4041
$instance = new static();
4142
$instance->openAPISchema = (new LeagueOpenAPI\SchemaFactory\JsonFactory($json))->createSchema();
@@ -47,7 +48,7 @@ public static function createFromJson(string $json) : self
4748
* @throws TypeErrorException
4849
* @throws UnresolvableReferenceException
4950
*/
50-
public static function createFromYaml(string $yaml) : self
51+
public static function createFromYaml(string $yaml): self
5152
{
5253
$instance = new static();
5354
$instance->openAPISchema = (new LeagueOpenAPI\SchemaFactory\YamlFactory($yaml))->createSchema();
@@ -143,7 +144,7 @@ public function mockComponentSchema(string $schemaName)
143144
/**
144145
* @throws NoPath
145146
*/
146-
private function findOperation(string $path, string $method) : Operation
147+
private function findOperation(string $path, string $method): Operation
147148
{
148149
try {
149150
$operation = (new LeagueOpenAPI\SpecFinder($this->openAPISchema))

src/SchemaFaker/ArrayFaker.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use cebe\openapi\spec\Schema;
88
use Faker\Provider\Base;
9+
910
use function array_unique;
1011
use function array_values;
1112

@@ -17,7 +18,7 @@ final class ArrayFaker
1718
/**
1819
* @return array<mixed>
1920
*/
20-
public static function generate(Schema $schema) : array
21+
public static function generate(Schema $schema): array
2122
{
2223
$minimum = $schema->minItems ?? 0;
2324
$maximum = $schema->maxItems ?? $minimum + 15;

src/SchemaFaker/BooleanFaker.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66

77
use cebe\openapi\spec\Schema;
88
use Faker\Provider\Base;
9+
910
use function random_int;
1011

1112
/**
1213
* @internal
1314
*/
1415
final class BooleanFaker
1516
{
16-
public static function generate(Schema $schema) : bool
17+
public static function generate(Schema $schema): bool
1718
{
1819
if ($schema->enum !== null) {
1920
return Base::randomElement($schema->enum);

src/SchemaFaker/NumberFaker.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use cebe\openapi\spec\Schema;
88
use Faker\Provider\Base;
9+
910
use function mt_getrandmax;
1011

1112
/**

src/SchemaFaker/ObjectFaker.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use cebe\openapi\spec\Schema;
88
use Faker\Provider\Base;
9+
910
use function array_diff;
1011
use function array_keys;
1112
use function array_merge;
@@ -20,7 +21,7 @@ final class ObjectFaker
2021
/**
2122
* @return array<mixed>
2223
*/
23-
public static function generate(Schema $schema) : array
24+
public static function generate(Schema $schema): array
2425
{
2526
$result = [];
2627

src/SchemaFaker/SchemaFaker.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use cebe\openapi\spec\Schema;
88
use Faker\Provider\Base;
9+
910
use function array_key_exists;
1011
use function array_reverse;
1112
use function in_array;
@@ -64,7 +65,7 @@ public function generate()
6465
*
6566
* @return array<mixed>
6667
*/
67-
private function resolveOfConstraints(array $schema) : array
68+
private function resolveOfConstraints(array $schema): array
6869
{
6970
$copy = $schema;
7071
foreach ($copy as $key => $item) {
@@ -108,7 +109,7 @@ private function resolveOfConstraints(array $schema) : array
108109
*
109110
* @return array<mixed>
110111
*/
111-
private function merge(array $firstArray, array $secondArray) : array
112+
private function merge(array $firstArray, array $secondArray): array
112113
{
113114
// phpcs:ignore
114115
foreach ($secondArray as $key => $_) {

0 commit comments

Comments
 (0)