Skip to content

Commit

Permalink
get rid of forks (#174)
Browse files Browse the repository at this point in the history
* get rid of forks

* Fix static analysis complaints

* Fix mutation testing error

* fix phpstan error

Co-authored-by: Patrik Foldes <[email protected]>
  • Loading branch information
sspat and Patrik Foldes authored Jul 21, 2022
1 parent 0223f4f commit 303688c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 27 deletions.
13 changes: 0 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,6 @@ All you have to do is to implement the API call handler interfaces and return th

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

The following workaround with a forked version of `cebe/php-openapi` will be used until a version of it
compatible with php 8.1 will be released:

Add to your composer.json
```
"repositories": [
{
"type": "vcs",
"url": "https://github.com/onmoon/php-openapi"
}
],
```

Run

```
Expand Down
14 changes: 2 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"require": {
"php": "^8.0",
"ext-json": "*",
"cebe/php-openapi": "dev-php-81-compat",
"league/openapi-psr7-validator": "dev-use-forked-php-openapi",
"cebe/php-openapi": "^1.7",
"league/openapi-psr7-validator": "^0.18.0",
"lukasoppermann/http-status": "^3.2",
"nikic/php-parser": "^4.13",
"nyholm/psr7": "^1.5",
Expand Down Expand Up @@ -60,16 +60,6 @@
"thecodingmachine/phpstan-safe-rule": "^1.2",
"vimeo/psalm": "^4.22"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/onmoon/php-openapi"
},
{
"type": "vcs",
"url": "https://github.com/onmoon/openapi-psr7-validator"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
Expand Down
12 changes: 12 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ parameters:
message: '#Instanceof between cebe\\openapi\\spec\\MediaType and cebe\\openapi\\spec\\MediaType will always evaluate to true\.#'
paths:
- %currentWorkingDirectory%/src/Specification/SpecificationParser.php
-
message: '#SpecificationLoaderTest\.php:55\)\) of method#'
paths:
- %currentWorkingDirectory%/test/functional/Specification/SpecificationLoaderTest.php
-
message: '#TestApiServerCodeGeneratorFactory\.php:55\)\) of method#'
paths:
- %currentWorkingDirectory%/test/generation/TestApiServerCodeGeneratorFactory.php
-
message: '#OnMoon\\OpenApiServerBundle\\Router\\RouteLoader::__construct\(\) does not call parent constructor from Symfony\\Component\\Config\\Loader\\Loader\.#'
paths:
- %currentWorkingDirectory%/src/Router/RouteLoader.php
includes:
- vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
Expand Down
5 changes: 3 additions & 2 deletions src/Router/RouteLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use OnMoon\OpenApiServerBundle\Controller\ApiController;
use OnMoon\OpenApiServerBundle\Specification\SpecificationLoader;
use OnMoon\OpenApiServerBundle\Types\ArgumentResolver;
use Stringable;
use Symfony\Component\Config\Loader\Loader;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
Expand All @@ -25,8 +26,6 @@ public function __construct(SpecificationLoader $loader, ArgumentResolver $argum
{
$this->loader = $loader;
$this->argumentResolver = $argumentResolver;

parent::__construct();
}

public function load(mixed $resource, ?string $type = null): RouteCollection
Expand All @@ -37,10 +36,12 @@ public function load(mixed $resource, ?string $type = null): RouteCollection
$routes = new RouteCollection();

foreach ($specification->getOperations() as $operationId => $operation) {
/** @psalm-var array<(string|Stringable)> $requirements */
$requirements = [];

$parameters = $operation->getRequestParameters();
if (array_key_exists('path', $parameters)) {
/** @psalm-var array<(string|Stringable)> $requirements */
$requirements = $this->argumentResolver->resolveArgumentPatterns($parameters['path']);
}

Expand Down

0 comments on commit 303688c

Please sign in to comment.