Skip to content

Drop PHP 7.4 support #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ jobs:

strategy:
matrix:
php: [7.4]
php: [8.0]
dependencies: [locked]

steps:
@@ -76,7 +76,7 @@ jobs:

strategy:
matrix:
php: [7.4,8.0, 8.1]
php: [8.0, 8.1]

dependencies: [locked]

@@ -134,7 +134,7 @@ jobs:

strategy:
matrix:
php: [7.4, 8.0, 8.1]
php: [8.0, 8.1]

dependencies:
- "lowest"
@@ -185,7 +185,7 @@ jobs:

strategy:
matrix:
php: [7.4, 8.0, 8.1]
php: [8.0, 8.1]

dependencies:
- "locked"
@@ -239,7 +239,7 @@ jobs:

strategy:
matrix:
php: [7.4, 8.0]
php: [8.0]

dependencies:
- "locked"
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## [2.0.0] - 2022-08-23

### Changed
- Dropped PHP 7.4 support

## [1.0.0] - 2021-11-19

### Changed
@@ -43,7 +48,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

Initial release!

[Unreleased]: https://github.com/canvural/php-openapi-faker/compare/1.0.0...HEAD
[Unreleased]: https://github.com/canvural/php-openapi-faker/compare/2.0.0...HEAD
[2.0.0]: https://github.com/canvural/php-openapi-faker/compare/1.0.0...2.0.0
[1.0.0]: https://github.com/canvural/php-openapi-faker/compare/0.1.5...1.0.0
[0.1.5]: https://github.com/canvural/php-openapi-faker/compare/0.1.4...0.1.5
[0.1.4]: https://github.com/canvural/php-openapi-faker/compare/0.1.3...0.1.4
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -10,17 +10,17 @@
}
],
"require": {
"php": ">=7.4",
"php": "^8.0 || ^8.1",
"ext-json": "*",
"cebe/php-openapi": "^1.7",
"fakerphp/faker": "^1.20",
"league/openapi-psr7-validator": "^0.18",
"thecodingmachine/safe": "^1.3"
"thecodingmachine/safe": "^2.2"
},
"require-dev": {
"doctrine/coding-standard": "^9",
"ergebnis/composer-normalize": "^2.27",
"infection/infection": "^0.25",
"infection/infection": "^0.26",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.7",
"phpstan/phpstan-phpunit": "^1",
5 changes: 1 addition & 4 deletions infection.json.dist
Original file line number Diff line number Diff line change
@@ -5,10 +5,7 @@
]
},
"logs": {
"text": ".build/infection/infection-log.txt",
"badge": {
"branch": "master"
}
"text": ".build/infection/infection-log.txt"
},
"mutators": {
"@default": true,
12 changes: 3 additions & 9 deletions src/OpenAPIFaker.php
Original file line number Diff line number Diff line change
@@ -60,16 +60,14 @@ public static function createFromYaml(string $yaml): self
}

/**
* @return mixed
*
* @throws NoPath
* @throws NoRequest
*/
public function mockRequest(
string $path,
string $method,
string $contentType = 'application/json'
) {
): mixed {
$operation = $this->findOperation($path, $method);

if ($operation->requestBody === null) {
@@ -88,8 +86,6 @@ public function mockRequest(
}

/**
* @return mixed
*
* @throws NoPath
* @throws NoResponse
*/
@@ -98,7 +94,7 @@ public function mockResponse(
string $method,
string $statusCode = '200',
string $contentType = 'application/json'
) {
): mixed {
$operation = $this->findOperation($path, $method);

if ($operation->responses === null) {
@@ -124,11 +120,9 @@ public function mockResponse(
}

/**
* @return mixed
*
* @throws Exception
*/
public function mockComponentSchema(string $schemaName)
public function mockComponentSchema(string $schemaName): mixed
{
if ($this->openAPISchema->components === null) {
throw NoSchema::forZeroComponents();
5 changes: 1 addition & 4 deletions src/SchemaFaker/NumberFaker.php
Original file line number Diff line number Diff line change
@@ -14,10 +14,7 @@
*/
final class NumberFaker
{
/**
* @return int|float
*/
public static function generate(Schema $schema)
public static function generate(Schema $schema): int|float
{
if ($schema->enum !== null) {
return Base::randomElement($schema->enum);
2 changes: 1 addition & 1 deletion src/SchemaFaker/SchemaFaker.php
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ public function __construct(Schema $schema, Options $options, bool $request = fa
/**
* @return array<mixed>|string|bool|int|float
*/
public function generate()
public function generate(): array|string|bool|int|float
{
if ($this->schema->type === 'array') {
return ArrayFaker::generate($this->schema, $this->options);