Skip to content

Commit 9329d50

Browse files
authored
Prepare 2.1.0 release (#123)
1 parent 101dab3 commit 9329d50

28 files changed

+230
-225
lines changed

composer.json

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
"phpstan/phpstan": "^1.9",
2626
"phpstan/phpstan-phpunit": "^1",
2727
"phpunit/phpunit": "^9.5",
28+
"rector/rector": "^0.14.7",
2829
"spatie/phpunit-snapshot-assertions": "^4.2",
29-
"symfony/var-dumper": "^5.4",
30+
"symfony/var-dumper": "^6",
3031
"thecodingmachine/phpstan-safe-rule": "^1.2"
3132
},
3233
"prefer-stable": true,
@@ -51,17 +52,6 @@
5152
"sort-packages": true
5253
},
5354
"scripts": {
54-
"check": [
55-
"@codestyle",
56-
"@phpstan",
57-
"@test"
58-
],
59-
"ci:check": [
60-
"@codestyle",
61-
"@phpstan",
62-
"@test-coverage",
63-
"@test-mutation"
64-
],
6555
"codestyle": "vendor/bin/phpcs",
6656
"phpstan": "vendor/bin/phpstan analyse --ansi",
6757
"test": "vendor/bin/phpunit",

infection.json.dist

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
"@default": true,
1212
"global-ignore": [
1313
"Vural\\OpenAPIFaker\\SchemaFaker\\BooleanFaker",
14-
"Vural\\OpenAPIFaker\\Utils\\RegexUtils::generateSample",
15-
"Vural\\OpenAPIFaker\\Utils\\StringUtils::convertToBinary",
16-
"Vural\\OpenAPIFaker\\Utils\\StringUtils::ensureLength",
17-
"Vural\\OpenAPIFaker\\Utils\\NumberUtils::ensureRange"
14+
"Vural\\OpenAPIFaker\\Utils\\RegexUtils",
1815
],
1916
"LessThan": {
2017
"ignore": [

phpstan-baseline.neon

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
parameters:
22
ignoreErrors:
3+
-
4+
message: "#^Method Vural\\\\OpenAPIFaker\\\\OpenAPIFaker\\:\\:findComponentSchema\\(\\) should return cebe\\\\openapi\\\\spec\\\\Schema but returns cebe\\\\openapi\\\\spec\\\\Reference\\|cebe\\\\openapi\\\\spec\\\\Schema\\.$#"
5+
count: 1
6+
path: src/OpenAPIFaker.php
7+
38
-
49
message: "#^Parameter \\#1 \\$schema of class Vural\\\\OpenAPIFaker\\\\SchemaFaker\\\\SchemaFaker constructor expects cebe\\\\openapi\\\\spec\\\\Schema, cebe\\\\openapi\\\\spec\\\\Reference\\|cebe\\\\openapi\\\\spec\\\\Schema\\|null given\\.$#"
510
count: 1
6-
path: src/SchemaFaker/RequestFaker.php
7-
11+
path: src/SchemaFaker/ArrayFaker.php
12+
813
-
914
message: "#^Parameter \\#1 \\$schema of class Vural\\\\OpenAPIFaker\\\\SchemaFaker\\\\SchemaFaker constructor expects cebe\\\\openapi\\\\spec\\\\Schema, cebe\\\\openapi\\\\spec\\\\Reference\\|cebe\\\\openapi\\\\spec\\\\Schema\\|null given\\.$#"
1015
count: 1
11-
path: src/SchemaFaker/ResponseFaker.php
16+
path: src/SchemaFaker/RequestFaker.php
1217

1318
-
1419
message: "#^Parameter \\#1 \\$schema of class Vural\\\\OpenAPIFaker\\\\SchemaFaker\\\\SchemaFaker constructor expects cebe\\\\openapi\\\\spec\\\\Schema, cebe\\\\openapi\\\\spec\\\\Reference\\|cebe\\\\openapi\\\\spec\\\\Schema\\|null given\\.$#"
1520
count: 1
16-
path: src/SchemaFaker/ArrayFaker.php
21+
path: src/SchemaFaker/ResponseFaker.php

rector.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
6+
use Rector\CodingStyle\Rector\ClassConst\VarConstantCommentRector;
7+
use Rector\Config\RectorConfig;
8+
use Rector\Set\ValueObject\LevelSetList;
9+
use Rector\Set\ValueObject\SetList;
10+
use Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector;
11+
12+
return static function (RectorConfig $rectorConfig): void {
13+
$rectorConfig->paths([
14+
__DIR__ . '/src',
15+
]);
16+
17+
$rectorConfig->sets([
18+
LevelSetList::UP_TO_PHP_80,
19+
SetList::CODE_QUALITY,
20+
SetList::DEAD_CODE,
21+
SetList::TYPE_DECLARATION,
22+
SetList::TYPE_DECLARATION_STRICT,
23+
SetList::CODING_STYLE,
24+
SetList::PRIVATIZATION,
25+
]);
26+
27+
$rectorConfig->skip([
28+
VarConstantCommentRector::class,
29+
]);
30+
};

src/Exception/NoContentType.php

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

77
use Exception;
88

9-
class NoContentType extends Exception
9+
final class NoContentType extends Exception
1010
{
1111
}

src/Exception/NoExample.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,17 @@
66

77
use Exception;
88

9-
use function Safe\sprintf;
9+
use function sprintf;
1010

11-
class NoExample extends Exception
11+
final class NoExample extends Exception
1212
{
13-
protected string $example;
14-
1513
public static function forRequest(string $example): self
1614
{
17-
$e = new self(sprintf('OpenAPI spec does not have a example "%s" request', $example));
18-
$e->example = $example;
19-
20-
return $e;
15+
return new self(sprintf('OpenAPI spec does not have an example "%s" request', $example));
2116
}
2217

2318
public static function forResponse(string $example): self
2419
{
25-
$e = new self(sprintf('OpenAPI spec does not have a example "%s" response', $example));
26-
$e->example = $example;
27-
28-
return $e;
20+
return new self(sprintf('OpenAPI spec does not have an example "%s" response', $example));
2921
}
3022
}

src/Exception/NoPath.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,12 @@
66

77
use Exception;
88

9-
use function Safe\sprintf;
9+
use function sprintf;
1010

11-
class NoPath extends Exception
11+
final class NoPath extends Exception
1212
{
13-
protected string $method;
14-
protected string $path;
15-
1613
public static function forPathAndMethod(string $path, string $method): self
1714
{
18-
$e = new self(sprintf('OpenAPI spec does not have a path for %s %s', $method, $path));
19-
$e->path = $path;
20-
$e->method = $method;
21-
22-
return $e;
15+
return new self(sprintf('OpenAPI spec does not have a path for %s %s', $method, $path));
2316
}
2417
}

src/Exception/NoRequest.php

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,17 @@
66

77
use Exception;
88

9-
use function Safe\sprintf;
9+
use function sprintf;
1010

11-
class NoRequest extends Exception
11+
final class NoRequest extends Exception
1212
{
13-
protected string $method;
14-
protected string $path;
15-
protected string $contentType;
16-
1713
public static function forPathAndMethod(string $path, string $method): self
1814
{
19-
$e = new self(sprintf('OpenAPI spec does not have a response for %s %s', $method, $path));
20-
$e->path = $path;
21-
$e->method = $method;
22-
23-
return $e;
15+
return new self(sprintf('OpenAPI spec does not have a response for %s %s', $method, $path));
2416
}
2517

2618
public static function forPathAndMethodAndContentType(string $path, string $method, string $contentType): self
2719
{
28-
$e = new self(sprintf('OpenAPI spec does not have a response for %s %s', $method, $path));
29-
$e->path = $path;
30-
$e->method = $method;
31-
$e->contentType = $contentType;
32-
33-
return $e;
20+
return new self(sprintf('OpenAPI spec does not have a response for %s %s', $method, $path));
3421
}
3522
}

src/Exception/NoResponse.php

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,17 @@
66

77
use Exception;
88

9-
use function Safe\sprintf;
9+
use function sprintf;
1010

11-
class NoResponse extends Exception
11+
final class NoResponse extends Exception
1212
{
13-
protected string $method;
14-
protected string $path;
15-
protected string|null $statusCode = null;
16-
1713
public static function forPathAndMethod(string $path, string $method): self
1814
{
19-
$e = new self(sprintf('OpenAPI spec does not have a response for %s %s', $method, $path));
20-
$e->path = $path;
21-
$e->method = $method;
22-
23-
return $e;
15+
return new self(sprintf('OpenAPI spec does not have a response for %s %s', $method, $path));
2416
}
2517

2618
public static function forPathAndMethodAndStatusCode(string $path, string $method, string $statusCode): self
2719
{
28-
$e = new self(sprintf('OpenAPI spec does not have a response for status code %s at %s %s', $statusCode, $method, $path));
29-
$e->path = $path;
30-
$e->method = $method;
31-
$e->statusCode = $statusCode;
32-
33-
return $e;
20+
return new self(sprintf('OpenAPI spec does not have a response for status code %s at %s %s', $statusCode, $method, $path));
3421
}
3522
}

src/Exception/NoSchema.php

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

77
use Exception;
88

9-
use function Safe\sprintf;
9+
use function sprintf;
1010

11-
class NoSchema extends Exception
11+
final class NoSchema extends Exception
1212
{
1313
public string $name;
1414

0 commit comments

Comments
 (0)