Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
"require-dev": {
"doctrine/common": "^2.0 | ^3.0",
"doctrine/doctrine-bundle": "^2.4",
"phpunit/phpunit": "^8.5.0",
"phpunit/phpunit": "^11.0",
"symfony/browser-kit": "^7.0",
"symfony/css-selector": "^7.0",
"symfony/framework-bundle": "^7.0",
"symfony/twig-bundle": "^7.0",
"symfony/yaml": "^7.0",
"zenstruck/foundry": "^1.0"
"zenstruck/foundry": "^2.8"
},

"autoload": {
Expand Down
14 changes: 5 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd"
colors="true">

<php>
Expand All @@ -13,15 +13,11 @@
<env name="APP_DEBUG" value="0"/>
</php>

<!-- Filter for code coverage -->
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<coverage>
<include>
<directory suffix=".php">src/</directory>
<exclude>
<directory>vendor</directory>
</exclude>
</whitelist>
</filter>
</include>
</coverage>

<testsuites>
<testsuite name="App Test Suite">
Expand Down
4 changes: 2 additions & 2 deletions src/DeleteRegistration/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct(UrlGeneratorInterface $urlGenerator)
$this->urlGenerator = $urlGenerator;
}

public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
parent::buildForm($builder, $options);

Expand All @@ -31,7 +31,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
);
}

public function configureOptions(OptionsResolver $resolver)
public function configureOptions(OptionsResolver $resolver): void
{
parent::configureOptions($resolver);

Expand Down
2 changes: 1 addition & 1 deletion src/EditRegistration/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct(NewsletterRepositoryInterface $newsletterRepository)
$this->newsletterRepository = $newsletterRepository;
}

public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$this->addNewslettersElementToForm($builder, false);

Expand Down
2 changes: 2 additions & 0 deletions src/Entity/DetermineAppsSubclassHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Webfactory\NewsletterRegistrationBundle\Entity;

use Exception;
use ReflectionClass;

class DetermineAppsSubclassHelper
{
Expand All @@ -12,6 +13,7 @@ public static function getAppsSubclassOf(string $parentClass, Exception $excepti
if (
is_subclass_of($class, $parentClass)
&& 0 !== strpos($class, 'Webfactory\NewsletterRegistrationBundle')
&& is_file((string) (new ReflectionClass($class))->getFileName())
) {
return $class;
}
Expand Down
4 changes: 2 additions & 2 deletions src/StartRegistration/EmailAddressType.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct(
$this->translator = $translator;
}

public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->setDataMapper($this);

Expand All @@ -72,7 +72,7 @@ public function getParent(): string
return TextType::class;
}

public function configureOptions(OptionsResolver $resolver)
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'empty_data' => null,
Expand Down
2 changes: 1 addition & 1 deletion src/StartRegistration/HoneypotType.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function getParent(): string
return TextType::class;
}

public function configureOptions(OptionsResolver $resolver)
public function configureOptions(OptionsResolver $resolver): void
{
parent::configureOptions($resolver);
$resolver->setDefaults([
Expand Down
2 changes: 1 addition & 1 deletion src/StartRegistration/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(NewsletterRepositoryInterface $newsletterRepository,
$this->pendingOptInFactory = $pendingOptInFactory;
}

public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add(static::ELEMENT_EMAIL_ADDRESS, EmailAddressType::class);

Expand Down
10 changes: 5 additions & 5 deletions tests/Factory/BlockedEmailAddressHashFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@

use DateTimeImmutable;
use Webfactory\NewsletterRegistrationBundle\Entity\BlockedEmailAddressHash;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;

final class BlockedEmailAddressHashFactory extends ModelFactory
final class BlockedEmailAddressHashFactory extends PersistentProxyObjectFactory
{
protected function getDefaults(): array
protected function defaults(): array
{
return [
'hash' => self::faker()->sha1(),
'blockDate' => new DateTimeImmutable(),
];
}

protected function initialize(): self
protected function initialize(): static
{
return $this->instantiateWith(function (array $attributes): BlockedEmailAddressHash {
return new BlockedEmailAddressHash($attributes['hash'], $attributes['blockDate']);
});
}

protected static function getClass(): string
public static function class(): string
{
return BlockedEmailAddressHash::class;
}
Expand Down
10 changes: 5 additions & 5 deletions tests/Factory/NewsletterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
namespace Webfactory\NewsletterRegistrationBundle\Tests\Factory;

use Webfactory\NewsletterRegistrationBundle\Tests\Entity\Dummy\Newsletter;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;

final class NewsletterFactory extends ModelFactory
final class NewsletterFactory extends PersistentProxyObjectFactory
{
protected function getDefaults(): array
protected function defaults(): array
{
return [
'name' => self::faker()->word(),
Expand All @@ -16,14 +16,14 @@ protected function getDefaults(): array
];
}

protected function initialize(): self
protected function initialize(): static
{
return $this->instantiateWith(function (array $attributes): Newsletter {
return new Newsletter(null, $attributes['name'], $attributes['rank'], $attributes['visible']);
});
}

protected static function getClass(): string
public static function class(): string
{
return Newsletter::class;
}
Expand Down
10 changes: 5 additions & 5 deletions tests/Factory/PendingOptInFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
use DateTimeImmutable;
use Webfactory\NewsletterRegistrationBundle\Entity\EmailAddress;
use Webfactory\NewsletterRegistrationBundle\Tests\Entity\Dummy\PendingOptIn;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;

final class PendingOptInFactory extends ModelFactory
final class PendingOptInFactory extends PersistentProxyObjectFactory
{
protected function getDefaults(): array
protected function defaults(): array
{
return [
'uuid' => self::faker()->uuid(),
Expand All @@ -18,7 +18,7 @@ protected function getDefaults(): array
];
}

protected function initialize(): self
protected function initialize(): static
{
return $this->instantiateWith(function (array $attributes): PendingOptIn {
return new PendingOptIn(
Expand All @@ -30,7 +30,7 @@ protected function initialize(): self
});
}

protected static function getClass(): string
public static function class(): string
{
return PendingOptIn::class;
}
Expand Down
10 changes: 5 additions & 5 deletions tests/Factory/RecipientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@

use Webfactory\NewsletterRegistrationBundle\Entity\EmailAddress;
use Webfactory\NewsletterRegistrationBundle\Tests\Entity\Dummy\Recipient;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;

final class RecipientFactory extends ModelFactory
final class RecipientFactory extends PersistentProxyObjectFactory
{
protected function getDefaults(): array
protected function defaults(): array
{
return [
'uuid' => self::faker()->uuid(),
'emailAddress' => new EmailAddress(self::faker()->email(), null),
];
}

protected function initialize(): self
protected function initialize(): static
{
return $this->instantiateWith(function (array $attributes): Recipient {
return new Recipient($attributes['uuid'], $attributes['emailAddress']);
});
}

protected static function getClass(): string
public static function class(): string
{
return Recipient::class;
}
Expand Down
Loading