Skip to content

Commit

Permalink
drop php 7.3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Dec 10, 2021
1 parent 052b84f commit b1e7ea0
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 29 deletions.
3 changes: 1 addition & 2 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(LevelSetList::UP_TO_PHP_73);
$containerConfigurator->import(LevelSetList::UP_TO_PHP_74);
$containerConfigurator->import(SetList::CODE_QUALITY);
$containerConfigurator->import(SetList::NAMING);
$containerConfigurator->import(SetList::TYPE_DECLARATION);
Expand All @@ -20,7 +20,6 @@
$parameters->set(Option::PATHS, [__DIR__ . '/config', __DIR__ . '/src', __DIR__ . '/spec']);

$parameters->set(Option::AUTO_IMPORT_NAMES, true);
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_73);

$parameters->set(Option::SKIP, [
AbsolutizeRequireAndIncludePathRector::class,
Expand Down
4 changes: 1 addition & 3 deletions spec/Listener/ForceHttpsFactorySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

describe('->__invoke', function () {

given('container', function (): object {
return Double::instance(['implements' => ContainerInterface::class]);
});
given('container', fn(): object => Double::instance(['implements' => ContainerInterface::class]));

it('returns ' . ForceHttps::class . ' instance with default config', function (): void {

Expand Down
8 changes: 2 additions & 6 deletions spec/Middleware/ForceHttpsFactorySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,9 @@

describe('->__invoke', function () {

given('container', function (): object {
return Double::instance(['implements' => ContainerInterface::class]);
});
given('container', fn(): object => Double::instance(['implements' => ContainerInterface::class]));

given('router', function (): object {
return Double::instance(['implements' => RouterInterface::class]);
});
given('router', fn(): object => Double::instance(['implements' => RouterInterface::class]));

it('returns ' . ForceHttps::class . ' instance with default config', function (): void {

Expand Down
16 changes: 4 additions & 12 deletions spec/Middleware/ForceHttpsSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,13 @@

describe('->invoke()', function () {

given('response', function (): object {
return Double::instance(['implements' => ResponseInterface::class]);
});
given('response', fn(): object => Double::instance(['implements' => ResponseInterface::class]));

given('request', function (): object {
return Double::instance(['implements' => ServerRequestInterface::class]);
});
given('request', fn(): object => Double::instance(['implements' => ServerRequestInterface::class]));

given('uri', function (): object {
return Double::instance(['implements' => UriInterface::class]);
});
given('uri', fn(): object => Double::instance(['implements' => UriInterface::class]));

given('router', function (): object {
return Double::instance(['implements' => RouterInterface::class]);
});
given('router', fn(): object => Double::instance(['implements' => RouterInterface::class]));

it('not redirect on not-enable', function (): void {

Expand Down
3 changes: 1 addition & 2 deletions src/Listener/ForceHttps.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ public function forceHttpsScheme(MvcEvent $mvcEvent): void
}
}

$httpsRequestUri = $httpsRequestUri
?? $this->getFinalhttpsRequestUri((string) $http->setScheme('https'));
$httpsRequestUri ??= $this->getFinalhttpsRequestUri((string) $http->setScheme('https'));

// 308 keeps headers, request method, and request body
$response->setStatusCode(308);
Expand Down
6 changes: 2 additions & 4 deletions src/Middleware/ForceHttps.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class ForceHttps implements MiddlewareInterface
/** @var array */
private $config;

/** @var RouterInterface */
private $router;
private RouterInterface $router;

/**
* @param mixed[] $config
Expand Down Expand Up @@ -78,8 +77,7 @@ public function process(
}
}

$httpsRequestUri = $httpsRequestUri
?? $this->getFinalhttpsRequestUri((string) $uri->withScheme('https'));
$httpsRequestUri ??= $this->getFinalhttpsRequestUri((string) $uri->withScheme('https'));

// 308 keeps headers, request method, and request body
$response = $response->withStatus(308);
Expand Down

0 comments on commit b1e7ea0

Please sign in to comment.