Skip to content

Commit

Permalink
60 compat (#172)
Browse files Browse the repository at this point in the history
* upd

* 6.0 compat

* test
  • Loading branch information
sspat authored Apr 11, 2022
1 parent e3448f2 commit 0223f4f
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 93 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
- "ubuntu-latest"
- "windows-latest"
php-version:
- "7.4"
- "8.0"
- "8.1"
dependencies:
Expand Down
39 changes: 20 additions & 19 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}
],
"require": {
"php": "^7.4|^8.0",
"php": "^8.0",
"ext-json": "*",
"cebe/php-openapi": "dev-php-81-compat",
"league/openapi-psr7-validator": "dev-use-forked-php-openapi",
Expand All @@ -31,33 +31,34 @@
"nyholm/psr7": "^1.5",
"phpdocumentor/reflection-docblock": "^5.3",
"sspat/reserved-words": "^3.0",
"symfony/cache": "^5.3|^5.4",
"symfony/config": "^5.3|^5.4",
"symfony/console": "^5.3.7|^5.4.7",
"symfony/dependency-injection": "^5.3.2|^5.4.2",
"symfony/event-dispatcher": "^5.3|^5.4",
"symfony/http-kernel": "^5.3.12|^5.4.12",
"symfony/process": "^5.3.7|^5.4.7",
"symfony/cache": "^6.0",
"symfony/cache-contracts": "^3",
"symfony/config": "^6.0",
"symfony/console": "^6.0",
"symfony/dependency-injection": "^6.0",
"symfony/event-dispatcher": "^6.0",
"symfony/http-kernel": "^6.0",
"symfony/process": "^6.0",
"symfony/psr-http-message-bridge": "^2.1",
"symfony/routing": "^5.3.7|^5.4.7",
"symfony/yaml": "^5.3|^5.4",
"symfony/routing": "^6.0",
"symfony/yaml": "^6.0",
"thecodingmachine/safe": "^1.3|^2"
},
"require-dev": {
"doctrine/coding-standard": "^9.0",
"matthiasnoback/symfony-config-test": "^4.3",
"matthiasnoback/symfony-dependency-injection-test": "^4.3",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan": "^1.5",
"phpstan/phpstan-phpunit": "^1.1",
"phpstan/phpstan-strict-rules": "^1.1",
"phpunit/phpunit": "^9.5.13",
"roave/infection-static-analysis-plugin": "^1.16",
"squizlabs/php_codesniffer": "^3.6.1",
"symfony/browser-kit": "^5.3|^5.4",
"symfony/dom-crawler": "^5.3.7|^5.4.7",
"symfony/framework-bundle": "^5.3|^5.4",
"phpunit/phpunit": "^9.5",
"roave/infection-static-analysis-plugin": "^1.18",
"squizlabs/php_codesniffer": "^3.6",
"symfony/browser-kit": "^6.0",
"symfony/dom-crawler": "^6.0",
"symfony/framework-bundle": "^6.0",
"thecodingmachine/phpstan-safe-rule": "^1.2",
"vimeo/psalm": "^4.20"
"vimeo/psalm": "^4.22"
},
"repositories": [
{
Expand Down
5 changes: 1 addition & 4 deletions src/Router/RouteLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ public function __construct(SpecificationLoader $loader, ArgumentResolver $argum
parent::__construct();
}

/**
* @inheritDoc
*/
public function load($resource, ?string $type = null): RouteCollection
public function load(mixed $resource, ?string $type = null): RouteCollection
{
$specName = (string) $resource;
$specification = $this->loader->load($specName);
Expand Down
6 changes: 3 additions & 3 deletions test/functional/Controller/ApiControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ public function setUp(): void
$commandTester->execute(['command' => GenerateApiCodeCommand::COMMAND]);
$getGoodImplClassName = $this->createGetGoodImpl();

static::$container->set('petstore.getGood', new $getGoodImplClassName());
static::getContainer()->set('petstore.getGood', new $getGoodImplClassName());

$apiLoaderClass = TestKernel::$bundleRootNamespace . '\ServiceSubscriber\ApiServiceLoaderServiceSubscriber';
/** @var ApiLoader $apiLoader */
$apiLoader = new $apiLoaderClass(static::$container);
$apiLoader = new $apiLoaderClass(static::getContainer());

/** @var ApiController $apiController */
$apiController = static::$container->get(ApiController::class);
$apiController = static::getContainer()->get(ApiController::class);
$apiController->setApiLoader($apiLoader);
}

Expand Down
44 changes: 11 additions & 33 deletions test/functional/Specification/SpecificationLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace OnMoon\OpenApiServerBundle\Test\Functional\Specification;

use cebe\openapi\spec\OpenApi;
use DateInterval;
use DateTimeInterface;
use Exception;
use OnMoon\OpenApiServerBundle\Specification\Definitions\Specification;
use OnMoon\OpenApiServerBundle\Specification\Definitions\SpecificationConfig;
Expand Down Expand Up @@ -44,52 +46,34 @@ public function setUp(): void
/** @var Specification[] $items */
private array $items = [];

/**
* {@inheritDoc}
*/
public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null)
public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null): mixed
{
if (isset($this->items[$key])) {
return $this->items[$key];
}

$item = $callback(new class () implements ItemInterface {
/**
* {@inheritDoc}
*/
public function getKey()
public function getKey(): string
{
return '';
}

/**
* {@inheritDoc}
*/
public function set($value)
public function set(mixed $value): static
{
return $this;
}

/**
* {@inheritDoc}
*/
public function expiresAfter($time)
public function expiresAfter(int|DateInterval|null $time): static
{
return $this;
}

/**
* {@inheritDoc}
*/
public function isHit()
public function isHit(): bool
{
return true;
}

/**
* {@inheritDoc}
*/
public function get()
public function get(): mixed
{
return null;
}
Expand All @@ -102,18 +86,12 @@ public function getMetadata(): array
return [];
}

/**
* {@inheritDoc}
*/
public function tag($tags): ItemInterface
public function tag(string|iterable $tags): static
{
return $this;
}

/**
* {@inheritDoc}
*/
public function expiresAt($expiration)
public function expiresAt(?DateTimeInterface $expiration): static
{
return $this;
}
Expand All @@ -139,7 +117,7 @@ public function set(string $key, Specification $item): void
/**
* {@inheritDoc}
*/
public function invalidateTags(array $tags)
public function invalidateTags(array $tags): bool
{
return true;
}
Expand Down
44 changes: 11 additions & 33 deletions test/generation/TestApiServerCodeGeneratorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace OnMoon\OpenApiServerBundle\Test\Generation;

use DateInterval;
use DateTimeInterface;
use Lukasoppermann\Httpstatus\Httpstatus;
use OnMoon\OpenApiServerBundle\CodeGenerator\ApiServerCodeGenerator;
use OnMoon\OpenApiServerBundle\CodeGenerator\AttributeGenerator;
Expand Down Expand Up @@ -48,48 +50,30 @@ public static function getCodeGenerator(
),
new FileLocator(),
new class () implements TagAwareCacheInterface {
/**
* {@inheritDoc}
*/
public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null)
public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null): mixed
{
return $callback(new class () implements ItemInterface {
/**
* {@inheritDoc}
*/
public function getKey()
public function getKey(): string
{
return '';
}

/**
* {@inheritDoc}
*/
public function set($value)
public function set(mixed $value): static
{
return $this;
}

/**
* {@inheritDoc}
*/
public function expiresAfter($time)
public function expiresAfter(int|DateInterval|null $time): static
{
return $this;
}

/**
* {@inheritDoc}
*/
public function isHit()
public function isHit(): bool
{
return true;
}

/**
* {@inheritDoc}
*/
public function get()
public function get(): mixed
{
return null;
}
Expand All @@ -102,18 +86,12 @@ public function getMetadata(): array
return [];
}

/**
* {@inheritDoc}
*/
public function tag($tags): ItemInterface
public function tag(string|iterable $tags): static
{
return $this;
}

/**
* {@inheritDoc}
*/
public function expiresAt($expiration)
public function expiresAt(?DateTimeInterface $expiration): static
{
return $this;
}
Expand All @@ -123,7 +101,7 @@ public function expiresAt($expiration)
/**
* {@inheritDoc}
*/
public function invalidateTags(array $tags)
public function invalidateTags(array $tags): bool
{
return true;
}
Expand Down

0 comments on commit 0223f4f

Please sign in to comment.