Skip to content

Commit

Permalink
Drop symfony 4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Dec 8, 2021
1 parent c90d5ce commit 1793682
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 31 deletions.
12 changes: 4 additions & 8 deletions .github/settings.yml
Expand Up @@ -17,14 +17,10 @@ branches:
- "Webpack build"
- "Coding Standards (8)"
- "Static Code Analysis (8.1)"
- "Test (PHP 8, symfony 4.4, lowest)"
- "Test (PHP 8, symfony 5.1, lowest)"
- "Test (PHP 8, symfony 4.4, highest)"
- "Test (PHP 8, symfony 5.1, highest)"
- "Test (PHP 8.1, symfony 4.4, lowest)"
- "Test (PHP 8.1, symfony 5.1, lowest)"
- "Test (PHP 8.1, symfony 4.4, highest)"
- "Test (PHP 8.1, symfony 5.1, highest)"
- "Test (PHP 8, symfony 5.4, lowest)"
- "Test (PHP 8, symfony 5.4, highest)"
- "Test (PHP 8.1, symfony 5.4, lowest)"
- "Test (PHP 8.1, symfony 5.4, highest)"
- "Code Coverage (8.1)"
- "Mutation Tests (8.1)"
strict: true
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/continuous-integration.yml
Expand Up @@ -141,8 +141,7 @@ jobs:
- highest

symfony:
- 4.4
- 5.1
- 5.4

steps:
- name: "Checkout"
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Expand Up @@ -45,18 +45,18 @@
"php": "^8.0",
"sonata-project/block-bundle": "^3.23.0 || ^4.5.1",
"sonata-project/form-extensions": "^0.1.1 || ^1.4",
"symfony/dependency-injection": "^4.4 || ^5.0.4",
"symfony/event-dispatcher": "^4.4 || ^5.0.4",
"symfony/expression-language": "^4.4 || ^5.0.4",
"symfony/framework-bundle": "^4.4 || ^5.0.4",
"symfony/http-foundation": "^4.4 || ^5.0.4",
"symfony/http-kernel": "^4.4 || ^5.0.4",
"symfony/options-resolver": "^4.4 || ^5.0.4",
"symfony/twig-bundle": "^4.4 || ^5.0.4"
"symfony/dependency-injection": "^5.4",
"symfony/event-dispatcher": "^5.4",
"symfony/expression-language": "^5.4",
"symfony/framework-bundle": "^5.4",
"symfony/http-foundation": "^5.4",
"symfony/http-kernel": "^5.4",
"symfony/options-resolver": "^5.4",
"symfony/twig-bundle": "^5.4"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.0.1",
"symfony/browser-kit": "^4.4 || ^5.0.4"
"symfony/browser-kit": "^5.4"
},
"suggest": {
"nucleos/shariff-bundle": "If you need a GDPR conform social media widget integration"
Expand Down
19 changes: 17 additions & 2 deletions phpstan-baseline.neon
@@ -1,7 +1,22 @@
parameters:
ignoreErrors:
-
message: "#^Instantiated class Symfony\\\\Component\\\\HttpKernel\\\\Client not found\\.$#"
message: "#^Method Nucleos\\\\GDPRBundle\\\\Tests\\\\App\\\\AppKernel\\:\\:configureContainer\\(\\) has parameter \\$container with no type specified\\.$#"
count: 1
path: tests/App/AppKernel.php

-
message: "#^Method Nucleos\\\\GDPRBundle\\\\Tests\\\\App\\\\AppKernel\\:\\:configureContainer\\(\\) has parameter \\$loader with no type specified\\.$#"
count: 1
path: tests/App/AppKernel.php

-
message: "#^Method Nucleos\\\\GDPRBundle\\\\Tests\\\\App\\\\AppKernel\\:\\:configureRoutes\\(\\) has parameter \\$routes with no type specified\\.$#"
count: 1
path: tests/App/AppKernel.php

-
message: "#^Call to method getResponse\\(\\) on an unknown class Symfony\\\\Component\\\\HttpKernel\\\\Client\\.$#"
count: 1
path: tests/Block/Service/GDPRInformationBlockServiceIntegrationTest.php

Expand All @@ -11,7 +26,7 @@ parameters:
path: tests/Block/Service/GDPRInformationBlockServiceIntegrationTest.php

-
message: "#^Call to method getResponse\\(\\) on an unknown class Symfony\\\\Component\\\\HttpKernel\\\\Client\\.$#"
message: "#^Instantiated class Symfony\\\\Component\\\\HttpKernel\\\\Client not found\\.$#"
count: 1
path: tests/Block/Service/GDPRInformationBlockServiceIntegrationTest.php

6 changes: 3 additions & 3 deletions src/Block/Service/GDPRInformationBlockService.php
Expand Up @@ -71,9 +71,9 @@ public function configureCreateForm(FormMapper $form, BlockInterface $block): vo
$this->configureEditForm($form, $block);
}

public function configureEditForm(FormMapper $formMapper, BlockInterface $block): void
public function configureEditForm(FormMapper $form, BlockInterface $block): void
{
$formMapper->add('settings', ImmutableArrayType::class, [
$form->add('settings', ImmutableArrayType::class, [
'keys' => [
['text', TextType::class, [
'label' => 'form.label_text',
Expand Down Expand Up @@ -125,7 +125,7 @@ public function getName(): string

private function hasGdprCookie(): bool
{
$request = $this->request->getMasterRequest();
$request = $this->request->getMainRequest();

return null !== $request && $request->cookies->getBoolean(self::COOKIE_NAME);
}
Expand Down
26 changes: 20 additions & 6 deletions tests/App/AppKernel.php
Expand Up @@ -19,10 +19,9 @@
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;

final class AppKernel extends Kernel
{
Expand All @@ -33,7 +32,7 @@ public function __construct()
parent::__construct('test', false);
}

public function registerBundles()
public function registerBundles(): iterable
{
return [
new FrameworkBundle(),
Expand All @@ -58,13 +57,28 @@ public function getProjectDir(): string
return __DIR__;
}

protected function configureRoutes(RouteCollectionBuilder $routes): void
protected function configureRoutes($routes): void
{
if ($routes instanceof RoutingConfigurator) {
$routes
->add('twig-test', '/twig-test')
->controller(TwigTestController::class)
;

return;
}

$routes->add('/twig-test', TwigTestController::class);
}

protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void
protected function configureContainer($container, $loader): void
{
if ($container instanceof ContainerConfigurator) {
$container->import(__DIR__.'/config/config.yaml');

return;
}

$loader->load(__DIR__.'/config/config.yaml');
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Block/Service/GDPRInformationBlockServiceTest.php
Expand Up @@ -43,7 +43,7 @@ protected function setUp(): void
$this->request = new Request();

$this->requestStack = $this->createMock(RequestStack::class);
$this->requestStack->method('getMasterRequest')
$this->requestStack->method('getMainRequest')
->willReturn($this->request)
;
}
Expand Down

0 comments on commit 1793682

Please sign in to comment.