Skip to content

Commit

Permalink
Merge branch 'release/3.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
nekofar committed May 18, 2023
2 parents 3113082 + efaad39 commit eb30f5a
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fetch-depth: 0

- name: Generate a changelog
uses: orhun/git-cliff-action@v2.0.5
uses: orhun/git-cliff-action@v2.0.6
id: git-cliff
with:
config: cliff.toml
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

All notable changes to this project will be documented in this file.

## [3.0.5] - 2023-05-18

### <!-- 04 -->Refactor

- Add all functions missing return types
- Remove redundant return types and extra whitespaces

### <!-- 07 -->Continuous Integrations

- Bump orhun/git-cliff-action from 2.0.5 to 2.0.6

### <!-- 08 -->Miscellaneous Tasks

- Bump nekofar/slim-test from ^3.1 to ^3.2
- Change `phpstan` level to the max
- Ignore call undefined methods error of `phpstand`

## [3.0.4] - 2023-05-15

### <!-- 05 -->Documentation
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"license": "MIT",
"require": {
"php": ">=8.1",
"nekofar/slim-test": "^3.1",
"nekofar/slim-test": "^3.2",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin": "^2.0"
},
Expand Down
5 changes: 4 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
parameters:
level: 5
level: max
paths:
- src

checkMissingIterableValueType: true
checkGenericClassInNonGenericObjectType: false
reportUnmatchedIgnoredErrors: true

ignoreErrors:
- '#^Call to an undefined method Pest\\PendingCalls\\TestCall\\|Pest\\Support\\HigherOrderTapProxy::#'
1 change: 0 additions & 1 deletion resources/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,4 @@
return $response;
});


return $app;
103 changes: 39 additions & 64 deletions src/Autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
/**
* Define additional headers to be sent with the request.
*
* @param array<string, string> $headers
*
* @param array<string, string> $headers
* @return mixed|TestCase
*/
function withHeaders(array $headers)
function withHeaders(array $headers): mixed
{
return test()->withHeaders(...func_get_args());
}
Expand All @@ -28,7 +27,7 @@ function withHeaders(array $headers)
*
* @return mixed|TestCase
*/
function withHeader(string $name, string $value)
function withHeader(string $name, string $value): mixed
{
return test()->withHeader(...func_get_args());
}
Expand All @@ -38,7 +37,7 @@ function withHeader(string $name, string $value)
*
* @return mixed|TestCase
*/
function withToken(string $token, string $type = 'Bearer')
function withToken(string $token, string $type = 'Bearer'): mixed
{
return test()->withToken(...func_get_args());
}
Expand All @@ -48,161 +47,137 @@ function withToken(string $token, string $type = 'Bearer')
*
* @return mixed|TestCase
*/
function flushHeaders()
function flushHeaders(): mixed
{
return test()->flushHeaders(...func_get_args());
}

/**
* Visit the given URI with a GET request.
*
* @param array<string, string> $headers
*
* @return TestResponse
* @param array<string, string> $headers
*/
function get(string $uri, array $headers = [])
function get(string $uri, array $headers = []): TestResponse
{
return test()->get(...func_get_args());
}

/**
* Visit the given URI with a GET request, expecting a JSON response.
*
* @param array<string, string> $headers
*
* @return TestResponse
* @param array<string, string> $headers
*/
function getJson(string $uri, array $headers = [])
function getJson(string $uri, array $headers = []): TestResponse
{
return test()->getJson(...func_get_args());
}

/**
* Visit the given URI with a POST request.
*
* @param array<string, mixed> $data
* @param array<string, string> $headers
*
* @return TestResponse
* @param array<string, mixed> $data
* @param array<string, string> $headers
*/
function post(string $uri, array $data = [], array $headers = [])
function post(string $uri, array $data = [], array $headers = []): TestResponse
{
return test()->post(...func_get_args());
}

/**
* Visit the given URI with a POST request, expecting a JSON response.
*
* @param array<string, mixed> $data
* @param array<string, string> $headers
*
* @return TestResponse
* @param array<string, mixed> $data
* @param array<string, string> $headers
*/
function postJson(string $uri, array $data = [], array $headers = [])
function postJson(string $uri, array $data = [], array $headers = []): TestResponse
{
return test()->postJson(...func_get_args());
}

/**
* Visit the given URI with a PUT request.
*
* @param array<string, mixed> $data
* @param array<string, string> $headers
*
* @return TestResponse
* @param array<string, mixed> $data
* @param array<string, string> $headers
*/
function put(string $uri, array $data = [], array $headers = [])
function put(string $uri, array $data = [], array $headers = []): TestResponse
{
return test()->put(...func_get_args());
}

/**
* Visit the given URI with a PUT request, expecting a JSON response.
*
* @param array<string, mixed> $data
* @param array<string, string> $headers
*
* @return TestResponse
* @param array<string, mixed> $data
* @param array<string, string> $headers
*/
function putJson(string $uri, array $data = [], array $headers = [])
function putJson(string $uri, array $data = [], array $headers = []): TestResponse
{
return test()->putJson(...func_get_args());
}

/**
* Visit the given URI with a PATCH request.
*
* @param array<string, mixed> $data
* @param array<string, string> $headers
*
* @return TestResponse
* @param array<string, mixed> $data
* @param array<string, string> $headers
*/
function patch(string $uri, array $data = [], array $headers = [])
function patch(string $uri, array $data = [], array $headers = []): TestResponse
{
return test()->patch(...func_get_args());
}

/**
* Visit the given URI with a PATCH request, expecting a JSON response.
*
* @param array<string, mixed> $data
* @param array<string, string> $headers
*
* @return TestResponse
* @param array<string, mixed> $data
* @param array<string, string> $headers
*/
function patchJson(string $uri, array $data = [], array $headers = [])
function patchJson(string $uri, array $data = [], array $headers = []): TestResponse
{
return test()->patchJson(...func_get_args());
}

/**
* Visit the given URI with a DELETE request.
*
* @param array<string, mixed> $data
* @param array<string, string> $headers
*
* @return TestResponse
* @param array<string, mixed> $data
* @param array<string, string> $headers
*/
function delete(string $uri, array $data = [], array $headers = [])
function delete(string $uri, array $data = [], array $headers = []): TestResponse
{
return test()->delete(...func_get_args());
}

/**
* Visit the given URI with a DELETE request, expecting a JSON response.
*
* @param array<string, mixed> $data
* @param array<string, string> $headers
*
* @return TestResponse
* @param array<string, mixed> $data
* @param array<string, string> $headers
*/
function deleteJson(string $uri, array $data = [], array $headers = [])
function deleteJson(string $uri, array $data = [], array $headers = []): TestResponse
{
return test()->deleteJson(...func_get_args());
}

/**
* Visit the given URI with a OPTIONS request.
*
* @param array<string, mixed> $data
* @param array<string, string> $headers
*
* @return TestResponse
* @param array<string, mixed> $data
* @param array<string, string> $headers
*/
function options(string $uri, array $data = [], array $headers = [])
function options(string $uri, array $data = [], array $headers = []): TestResponse
{
return test()->options(...func_get_args());
}

/**
* Visit the given URI with a OPTIONS request, expecting a JSON response.
*
* @param array<string, mixed> $data
* @param array<string, string> $headers
*
* @return TestResponse
* @param array<string, mixed> $data
* @param array<string, string> $headers
*/
function optionsJson(string $uri, array $data = [], array $headers = [])
function optionsJson(string $uri, array $data = [], array $headers = []): TestResponse
{
return test()->optionsJson(...func_get_args());
}
3 changes: 1 addition & 2 deletions tests/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Tests;

use Fig\Http\Message\StatusCodeInterface;

use function Nekofar\Slim\Pest\delete;
use function Nekofar\Slim\Pest\deleteJson;
use function Nekofar\Slim\Pest\get;
Expand Down Expand Up @@ -136,5 +135,5 @@
->get('/head/auth')
->assertOk()
->assertHeaderMissing('X-Test')
->assertHeader('Authorization', 'Basic ' . base64_encode('test:123456'));
->assertHeader('Authorization', 'Basic '.base64_encode('test:123456'));
});
2 changes: 1 addition & 1 deletion tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

uses()
->beforeEach(function (): void {
$app = require __DIR__ . '/../resources/bootstrap.php';
$app = require __DIR__.'/../resources/bootstrap.php';

// @phpstan-ignore-next-line
$this->setUpApp($app);
Expand Down

0 comments on commit eb30f5a

Please sign in to comment.