Skip to content

Commit

Permalink
Drop PHP 7.4 support (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
canvural authored Aug 23, 2022
1 parent beec466 commit cb44317
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 27 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

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

steps:
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:

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

dependencies: [locked]

Expand Down Expand Up @@ -134,7 +134,7 @@ jobs:

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

dependencies:
- "lowest"
Expand Down Expand Up @@ -185,7 +185,7 @@ jobs:

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

dependencies:
- "locked"
Expand Down Expand Up @@ -239,7 +239,7 @@ jobs:

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

dependencies:
- "locked"
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 1 addition & 4 deletions infection.json.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
]
},
"logs": {
"text": ".build/infection/infection-log.txt",
"badge": {
"branch": "master"
}
"text": ".build/infection/infection-log.txt"
},
"mutators": {
"@default": true,
Expand Down
12 changes: 3 additions & 9 deletions src/OpenAPIFaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -88,8 +86,6 @@ public function mockRequest(
}

/**
* @return mixed
*
* @throws NoPath
* @throws NoResponse
*/
Expand All @@ -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) {
Expand All @@ -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();
Expand Down
5 changes: 1 addition & 4 deletions src/SchemaFaker/NumberFaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/SchemaFaker/SchemaFaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cb44317

Please sign in to comment.