Skip to content

feat: declare strict types in tests and use override attribute #207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions tests/Integration/VerifyEmailBundleAutowireTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the SymfonyCasts VerifyEmailBundle package.
* Copyright (c) SymfonyCasts <https://symfonycasts.com/>
Expand Down
3 changes: 2 additions & 1 deletion tests/Integration/VerifyEmailServiceDefinitionTest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php

declare(strict_types=1);

/*
* This file is part of the SymfonyCasts VerifyEmailBundle package.
* Copyright (c) SymfonyCasts <https://symfonycasts.com/>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace SymfonyCasts\Bundle\VerifyEmail\Tests\Integration;

use PHPUnit\Framework\TestCase;
Expand Down
13 changes: 8 additions & 5 deletions tests/VerifyEmailTestKernel.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php

declare(strict_types=1);

/*
* This file is part of the SymfonyCasts VerifyEmailBundle package.
* Copyright (c) SymfonyCasts <https://symfonycasts.com/>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace SymfonyCasts\Bundle\VerifyEmail\Tests;

use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
Expand All @@ -32,8 +33,8 @@ class VerifyEmailTestKernel extends Kernel
*/
public function __construct(
private ?ContainerBuilder $builder = null,
private array $routes = [],
private array $extraBundles = [],
private readonly array $routes = [],
private readonly array $extraBundles = [],
) {
parent::__construct('test', true);
}
Expand All @@ -51,13 +52,13 @@ public function registerBundles(): iterable

public function registerContainerConfiguration(LoaderInterface $loader): void
{
if (null === $this->builder) {
if (!$this->builder instanceof \Symfony\Component\DependencyInjection\ContainerBuilder) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have a use statement for it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed at 7adfacf

$this->builder = new ContainerBuilder();
}

$builder = $this->builder;

$loader->load(function (ContainerBuilder $container) use ($builder) {
$loader->load(function (ContainerBuilder $container) use ($builder): void {
$container->merge($builder);
$container->loadFromExtension(
'framework',
Expand Down Expand Up @@ -92,11 +93,13 @@ public function loadRoutes(LoaderInterface $loader): RouteCollection
return $routes;
}

#[\Override]
public function getCacheDir(): string
{
return sys_get_temp_dir().'/cache'.spl_object_hash($this);
}

#[\Override]
public function getLogDir(): string
{
return sys_get_temp_dir().'/logs'.spl_object_hash($this);
Expand Down
Loading