Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d459d6c

Browse files
authored
refactor #13502 Move to PHP8.0 syntax in Components (Zales0123)
This PR was merged into the 1.11 branch. Discussion ---------- | Q | A | --------------- | ----- | Branch? | 1.11 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Related tickets | | License | MIT We can finally do that 🚀 ❤️ Commits ------- 14f33ad Move to PHP8.0 syntax in Components f403708 Fix some coding standards 6c680aa Coding standards fixes
2 parents 37f99d0 + 6c680aa commit d459d6c

161 files changed

Lines changed: 266 additions & 966 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

rector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
return static function (ContainerConfigurator $containerConfigurator): void
1212
{
13+
$containerConfigurator->import(SetList::PHP_80);
14+
1315
$parameters = $containerConfigurator->parameters();
1416
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
1517
$parameters->set(Option::IMPORT_SHORT_CLASSES, false);

src/Sylius/Component/Addressing/Factory/ZoneFactory.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,8 @@
1919

2020
final class ZoneFactory implements ZoneFactoryInterface
2121
{
22-
private FactoryInterface $factory;
23-
24-
private FactoryInterface $zoneMemberFactory;
25-
26-
public function __construct(FactoryInterface $factory, FactoryInterface $zoneMemberFactory)
22+
public function __construct(private FactoryInterface $factory, private FactoryInterface $zoneMemberFactory)
2723
{
28-
$this->factory = $factory;
29-
$this->zoneMemberFactory = $zoneMemberFactory;
3024
}
3125

3226
public function createNew(): ZoneInterface

src/Sylius/Component/Addressing/Matcher/ZoneMatcher.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121

2222
final class ZoneMatcher implements ZoneMatcherInterface
2323
{
24-
private RepositoryInterface $zoneRepository;
25-
2624
/**
2725
* @var array
2826
*/
@@ -32,9 +30,8 @@ final class ZoneMatcher implements ZoneMatcherInterface
3230
ZoneInterface::TYPE_ZONE,
3331
];
3432

35-
public function __construct(RepositoryInterface $zoneRepository)
33+
public function __construct(private RepositoryInterface $zoneRepository)
3634
{
37-
$this->zoneRepository = $zoneRepository;
3835
}
3936

4037
public function match(AddressInterface $address, ?string $scope = null): ?ZoneInterface

src/Sylius/Component/Addressing/Model/Country.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Sylius\Component\Resource\Model\ToggleableTrait;
1919
use Symfony\Component\Intl\Countries;
2020

21-
class Country implements CountryInterface
21+
class Country implements CountryInterface, \Stringable
2222
{
2323
use ToggleableTrait;
2424

src/Sylius/Component/Addressing/Model/Province.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace Sylius\Component\Addressing\Model;
1515

16-
class Province implements ProvinceInterface
16+
class Province implements ProvinceInterface, \Stringable
1717
{
1818
/** @var mixed */
1919
protected $id;

src/Sylius/Component/Addressing/Model/Zone.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Doctrine\Common\Collections\ArrayCollection;
1717
use Doctrine\Common\Collections\Collection;
1818

19-
class Zone implements ZoneInterface
19+
class Zone implements ZoneInterface, \Stringable
2020
{
2121
/** @var mixed */
2222
protected $id;

src/Sylius/Component/Addressing/Provider/ProvinceNamingProvider.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@
2020

2121
class ProvinceNamingProvider implements ProvinceNamingProviderInterface
2222
{
23-
private RepositoryInterface $provinceRepository;
24-
25-
public function __construct(RepositoryInterface $provinceRepository)
23+
public function __construct(private RepositoryInterface $provinceRepository)
2624
{
27-
$this->provinceRepository = $provinceRepository;
2825
}
2926

3027
public function getName(AddressInterface $address): string

src/Sylius/Component/Attribute/Factory/AttributeFactory.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,8 @@
2020

2121
final class AttributeFactory implements AttributeFactoryInterface
2222
{
23-
private FactoryInterface $factory;
24-
25-
private ServiceRegistryInterface $attributeTypesRegistry;
26-
27-
public function __construct(FactoryInterface $factory, ServiceRegistryInterface $attributeTypesRegistry)
23+
public function __construct(private FactoryInterface $factory, private ServiceRegistryInterface $attributeTypesRegistry)
2824
{
29-
$this->factory = $factory;
30-
$this->attributeTypesRegistry = $attributeTypesRegistry;
3125
}
3226

3327
public function createNew(): AttributeInterface

src/Sylius/Component/Attribute/Model/Attribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Sylius\Component\Resource\Model\TranslatableTrait;
1919
use Sylius\Component\Resource\Model\TranslationInterface;
2020

21-
class Attribute implements AttributeInterface
21+
class Attribute implements AttributeInterface, \Stringable
2222
{
2323
use TimestampableTrait;
2424
use TranslatableTrait {

src/Sylius/Component/Channel/Context/CachedPerRequestChannelContext.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,12 @@
1919

2020
final class CachedPerRequestChannelContext implements ChannelContextInterface
2121
{
22-
private ChannelContextInterface $decoratedChannelContext;
23-
24-
private RequestStack $requestStack;
25-
2622
private \SplObjectStorage $requestToChannelMap;
2723

2824
private \SplObjectStorage $requestToExceptionMap;
2925

30-
public function __construct(ChannelContextInterface $decoratedChannelContext, RequestStack $requestStack)
26+
public function __construct(private ChannelContextInterface $decoratedChannelContext, private RequestStack $requestStack)
3127
{
32-
$this->decoratedChannelContext = $decoratedChannelContext;
33-
$this->requestStack = $requestStack;
34-
3528
$this->requestToChannelMap = new \SplObjectStorage();
3629
$this->requestToExceptionMap = new \SplObjectStorage();
3730
}

0 commit comments

Comments
 (0)