Skip to content

Commit 3efa262

Browse files
authored
Require PHP 8.2 and modernize codebase (#284)
## Summary - Require PHP 8.2 as minimum version (PHP 8.0 and 8.1 are EOL) - Use constructor property promotion throughout - Add typed properties where missing - Remove deprecated `{@inheritdoc}` annotations
2 parents ae10297 + 2dcf7ac commit 3efa262

File tree

15 files changed

+25
-61
lines changed

15 files changed

+25
-61
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
php: ["8.1", "8.2", "8.3"]
20+
php: ["8.2", "8.3"]
2121
symfony: ["^5.4", "^6.4", "^7.0"]
2222
twig: ["^2.12", "^3.3"]
2323
exclude:
2424
- twig: "^2.12"
2525
symfony: "^7.0"
26-
- php: "8.1"
27-
symfony: "^7.0"
2826

2927
steps:
3028
-

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
}
2525
],
2626
"require": {
27-
"php": "^8.1",
27+
"php": "^8.2",
2828
"sylius-labs/polyfill-symfony-event-dispatcher": "^1.0",
2929
"symfony/config": "^5.4 || ^6.4 || ^7.0",
3030
"symfony/deprecation-contracts": "^2.1 || ^3.0",

src/Bundle/DependencyInjection/SyliusMailerExtension.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323

2424
final class SyliusMailerExtension extends ConfigurableExtension
2525
{
26-
/**
27-
* {@inheritdoc}
28-
*/
2926
protected function loadInternal(array $mergedConfig, ContainerBuilder $container): void
3027
{
3128
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));

src/Bundle/Renderer/Adapter/EmailDefaultAdapter.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020

2121
final class EmailDefaultAdapter extends AbstractAdapter
2222
{
23-
/** @var EventDispatcherInterface|null */
24-
protected $dispatcher;
25-
2623
public function __construct(?EventDispatcherInterface $dispatcher = null)
2724
{
2825
$this->dispatcher = $dispatcher;

src/Bundle/Renderer/Adapter/EmailTwigAdapter.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,19 @@
1818
use Sylius\Component\Mailer\Renderer\Adapter\AbstractAdapter;
1919
use Sylius\Component\Mailer\Renderer\RenderedEmail;
2020
use Sylius\Component\Mailer\SyliusMailerEvents;
21-
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
21+
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
2222
use Twig\Environment;
2323
use Twig\Loader\ArrayLoader;
2424

2525
class EmailTwigAdapter extends AbstractAdapter
2626
{
27-
/** @var Environment */
28-
protected $twig;
29-
30-
/** @var EventDispatcherInterface|null */
31-
protected $dispatcher;
32-
33-
public function __construct(Environment $twig, ?EventDispatcherInterface $dispatcher = null)
34-
{
35-
$this->twig = $twig;
27+
public function __construct(
28+
protected Environment $twig,
29+
?EventDispatcherInterface $dispatcher = null,
30+
) {
3631
$this->dispatcher = $dispatcher;
3732
}
3833

39-
/**
40-
* {@inheritdoc}
41-
*/
4234
public function render(EmailInterface $email, array $data = []): RenderedEmail
4335
{
4436
$renderedEmail = $this->getRenderedEmail($email, $data);

src/Bundle/Sender/Adapter/SymfonyMailerAdapter.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ public function __construct(private MailerInterface $mailer)
3232
{
3333
}
3434

35-
/**
36-
* {@inheritdoc}
37-
*/
3835
public function send(
3936
array $recipients,
4037
string $senderAddress,

src/Bundle/spec/Renderer/Adapter/EmailTwigAdapterSpec.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Sylius\Component\Mailer\Renderer\Adapter\AbstractAdapter;
2121
use Sylius\Component\Mailer\Renderer\RenderedEmail;
2222
use Sylius\Component\Mailer\SyliusMailerEvents;
23-
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
23+
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
2424
use Twig\Environment;
2525
use Twig\Template;
2626
use Twig\TemplateWrapper;

src/Bundle/spec/Sender/Adapter/SymfonyMailerAdapterSpec.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
use Sylius\Component\Mailer\Renderer\RenderedEmail;
2121
use Sylius\Component\Mailer\Sender\Adapter\AbstractAdapter;
2222
use Sylius\Component\Mailer\SyliusMailerEvents;
23+
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
2324
use Symfony\Component\Mailer\Exception\TransportException;
2425
use Symfony\Component\Mailer\MailerInterface;
2526
use Symfony\Component\Mime\Address;
2627
use Symfony\Component\Mime\Email;
27-
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
2828

2929
final class SymfonyMailerAdapterSpec extends ObjectBehavior
3030
{

src/Component/Event/EmailRenderEvent.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,13 @@
1818

1919
class EmailRenderEvent extends Event
2020
{
21-
/** @var RenderedEmail */
22-
protected $renderedEmail;
23-
24-
/** @var string[] */
25-
protected $recipients;
26-
27-
public function __construct(RenderedEmail $renderedEmail, array $recipients = [])
28-
{
29-
$this->renderedEmail = $renderedEmail;
30-
$this->recipients = $recipients;
21+
/**
22+
* @param string[] $recipients
23+
*/
24+
public function __construct(
25+
protected RenderedEmail $renderedEmail,
26+
protected array $recipients = [],
27+
) {
3128
}
3229

3330
public function getRenderedEmail(): RenderedEmail

src/Component/Factory/EmailFactory.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818

1919
class EmailFactory implements EmailFactoryInterface
2020
{
21-
/**
22-
* {@inheritdoc}
23-
*/
2421
public function createNew(): EmailInterface
2522
{
2623
return new Email();

0 commit comments

Comments
 (0)