Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
/.php-cs-fixer.dist.php export-ignore
/.phpunit.result.cache export-ignore
/composer.lock export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
rector.php export-ignore
/rector.php export-ignore
14 changes: 5 additions & 9 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,20 @@ We accept contributions via Pull Requests on Github.

## Pull Requests

- **[PSR-12 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-12-extended-coding-style-guide.md)** - Fix the code style with `composer fix`.
- **[PSR-12 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-12-extended-coding-style-guide.md)** - Fix the code's style with `composer fix`.

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
- **[PHPStan level 9](https://phpstan.org/user-guide/rule-levels)** - Check compliance with `composer type`.

- **Add tests!** - Your contribution won't be accepted if it doesn't have tests – Run the test suite with `composer test`.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.

- **Create feature branches** - Don't ask us to pull from your master branch.
- **Create feature branches** - Don't ask us to pull from your main branch.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **Send coherent history** - Make sure each individual commit in your pull request is meaningful.

## Testing

```bash
$ composer test
```

**Happy coding**!
21 changes: 19 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
- name: Set up PHP
uses: shivammathur/setup-php@v2

- name: Install composer dependencies
Expand All @@ -25,6 +25,23 @@ jobs:
- name: Check coding style
run: vendor/bin/php-cs-fixer fix --dry-run

type:
name: Type
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up PHP
uses: shivammathur/setup-php@v2

- name: Install composer dependencies
uses: ramsey/composer-install@v2

- name: Check code typing
run: vendor/bin/phpstan

tests:
name: Tests
runs-on: ubuntu-latest
Expand Down Expand Up @@ -55,5 +72,5 @@ jobs:
with:
dependency-versions: ${{ matrix.dependency-versions }}

- name: Run PHPUnit
- name: Run tests
run: vendor/bin/phpunit tests
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.17",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.6",
"rector/rector": "^0.17.1"
},
Expand All @@ -52,8 +53,10 @@
"scripts": {
"fix": "php-cs-fixer fix -v",
"test": "phpunit",
"type": "phpstan",
"all": [
"@fix",
"@type",
"@test"
],
"refactor": "rector process"
Expand Down
7 changes: 7 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
level: 9

paths:
- src

checkMissingCallableSignature: true
3 changes: 1 addition & 2 deletions src/Adapters/HttpFoundationAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use InvalidArgumentException;
use Nyholm\Psr7\Factory\Psr17Factory;
use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
Expand All @@ -20,7 +19,7 @@ final class HttpFoundationAdapter implements MessageAdapterInterface
*
* @param object $message the HTTP message to convert
*/
public function convert(object $message): MessageInterface
public function convert(object $message): ResponseInterface|ServerRequestInterface
{
if ($message instanceof ResponseInterface || $message instanceof ServerRequestInterface) {
return $message;
Expand Down
5 changes: 3 additions & 2 deletions src/Adapters/MessageAdapterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

namespace Osteel\OpenApi\Testing\Adapters;

use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;

interface MessageAdapterInterface
{
Expand All @@ -13,5 +14,5 @@ interface MessageAdapterInterface
*
* @param object $message the HTTP message to convert
*/
public function convert(object $message): MessageInterface;
public function convert(object $message): ResponseInterface|ServerRequestInterface;
}
2 changes: 2 additions & 0 deletions src/ValidatorBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
*/
final class ValidatorBuilder implements ValidatorBuilderInterface
{
/** @var class-string<MessageAdapterInterface> */
private string $adapter = HttpFoundationAdapter::class;

/** @var class-string<CacheAdapterInterface> */
private string $cacheAdapter = Psr16Adapter::class;

public function __construct(private BaseValidatorBuilder $validatorBuilder)
Expand Down