Skip to content

Commit 5ef0b3a

Browse files
committed
Transpile to PHP 8.0
1 parent a1bbd01 commit 5ef0b3a

19 files changed

+35
-34
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"symfony/cache": "^5.0 | ^6.0 | ^7.0",
1010
"nyholm/psr7": "^1.0",
1111
"unleash/client": "^2.4",
12-
"php": "^8.2"
12+
"php": "^8.0"
1313
},
1414
"autoload": {
1515
"psr-4": {

src/Command/TestFlagCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ final class TestFlagCommand extends Command
1818
{
1919
public function __construct(
2020
string $name,
21-
private readonly Unleash $unleash,
22-
private readonly CacheInterface $cache,
21+
private Unleash $unleash,
22+
private CacheInterface $cache,
2323
) {
2424
parent::__construct($name);
2525
}

src/Context/SymfonyContextProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Unleash\Client\Configuration\Context;
66
use Unleash\Client\ContextProvider\UnleashContextProvider;
77

8-
final readonly class SymfonyContextProvider implements UnleashContextProvider
8+
final class SymfonyContextProvider implements UnleashContextProvider
99
{
1010
public function __construct(
1111
private SymfonyUnleashContext $context

src/Context/SymfonyUnleashContext.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ final class SymfonyUnleashContext implements Context
3333
* @param array<string,string> $customProperties
3434
*/
3535
public function __construct(
36-
private readonly ?TokenStorageInterface $userTokenStorage,
37-
private readonly ?string $userIdField,
36+
private ?TokenStorageInterface $userTokenStorage,
37+
private ?string $userIdField,
3838
private array $customProperties,
39-
private readonly ?RequestStack $requestStack,
40-
private readonly ?ExpressionLanguage $expressionLanguage,
41-
private readonly ?EventDispatcherInterface $eventDispatcher,
39+
private ?RequestStack $requestStack,
40+
private ?ExpressionLanguage $expressionLanguage,
41+
private ?EventDispatcherInterface $eventDispatcher,
4242
private ?string $environment = null,
4343
) {
4444
}

src/DependencyInjection/Compiler/BootstrapResolver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/**
1313
* @todo Make internal in next major
1414
*/
15-
final readonly class BootstrapResolver implements CompilerPassInterface
15+
final class BootstrapResolver implements CompilerPassInterface
1616
{
1717
private const TAG = 'unleash.client.bootstrap_provider';
1818

src/DependencyInjection/Compiler/CacheServiceResolverCompilerPass.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/**
1515
* @todo Make internal in next major
1616
*/
17-
final readonly class CacheServiceResolverCompilerPass implements CompilerPassInterface
17+
final class CacheServiceResolverCompilerPass implements CompilerPassInterface
1818
{
1919
public function process(ContainerBuilder $container): void
2020
{

src/DependencyInjection/Compiler/HttpServicesResolverCompilerPass.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/**
1616
* @todo Make internal in next major
1717
*/
18-
final readonly class HttpServicesResolverCompilerPass implements CompilerPassInterface
18+
final class HttpServicesResolverCompilerPass implements CompilerPassInterface
1919
{
2020
public function process(ContainerBuilder $container): void
2121
{

src/DependencyInjection/Configuration.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/**
1616
* @todo Make internal in next major
1717
*/
18-
final readonly class Configuration implements ConfigurationInterface
18+
final class Configuration implements ConfigurationInterface
1919
{
2020
/**
2121
* @param array<string> $defaultStrategyNames

src/DependencyInjection/Dsn/LateBoundDsnParameter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Stringable;
66

7-
final readonly class LateBoundDsnParameter implements Stringable
7+
final class LateBoundDsnParameter implements Stringable
88
{
99
public function __construct(
1010
private string $envName,

src/DependencyInjection/Dsn/StaticStringableParameter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Stringable;
66

7-
final readonly class StaticStringableParameter implements Stringable
7+
final class StaticStringableParameter implements Stringable
88
{
99
public function __construct(
1010
private string $value,

src/Event/BeforeExceptionThrownForAttributeEvent.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ public function __construct(
1616
Response::HTTP_FORBIDDEN,
1717
Response::HTTP_BAD_REQUEST,
1818
Response::HTTP_UNAUTHORIZED,
19-
])]
20-
private readonly int $errorCode,
19+
])]private int $errorCode,
2120
) {
2221
}
2322

src/Event/ContextValueNotFoundEvent.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ final class ContextValueNotFoundEvent extends Event
99
private ?string $value = null;
1010

1111
public function __construct(
12-
private readonly string $contextName
12+
private string $contextName
1313
) {
1414
}
1515

src/Event/UnleashEvents.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Unleash\Client\Bundle\Event;
44

5-
final readonly class UnleashEvents
5+
final class UnleashEvents
66
{
77
/**
88
* @Event("Unleash\Client\Bundle\Event\ContextValueNotFoundEvent")

src/Listener/ControllerAttributeResolver.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
use Unleash\Client\Exception\InvalidValueException;
2626
use Unleash\Client\Unleash;
2727

28-
final readonly class ControllerAttributeResolver implements EventSubscriberInterface
28+
final class ControllerAttributeResolver implements EventSubscriberInterface
2929
{
3030
public function __construct(
3131
private Unleash $unleash,
@@ -63,12 +63,11 @@ public function onControllerResolved(ControllerEvent $event): void
6363
[$class, $method] = $controller;
6464
$reflectionClass = new ReflectionClass($class);
6565
$reflectionMethod = $reflectionClass->getMethod($method);
66+
$item0Unpacked = $reflectionClass->getAttributes(ControllerAttribute::class, ReflectionAttribute::IS_INSTANCEOF);
67+
$item1Unpacked = $reflectionMethod->getAttributes(ControllerAttribute::class, ReflectionAttribute::IS_INSTANCEOF);
6668

6769
/** @var array<ReflectionAttribute<ControllerAttribute>> $attributes */
68-
$attributes = [
69-
...$reflectionClass->getAttributes(ControllerAttribute::class, ReflectionAttribute::IS_INSTANCEOF),
70-
...$reflectionMethod->getAttributes(ControllerAttribute::class, ReflectionAttribute::IS_INSTANCEOF),
71-
];
70+
$attributes = array_merge($item0Unpacked, $item1Unpacked);
7271

7372
foreach ($attributes as $attribute) {
7473
$attribute = $attribute->newInstance();

src/Twig/FeatureTagNode.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
final class FeatureTagNode extends Node
99
{
1010
public function __construct(
11-
private readonly string $featureName,
12-
private readonly Node $content,
11+
private string $featureName,
12+
private Node $content,
1313
int $line,
1414
string $tag,
15-
private readonly string $extensionClass
15+
private string $extensionClass
1616
) {
1717
parent::__construct([], [], $line, $tag);
1818
}

src/Twig/FeatureTagTokenParser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
final class FeatureTagTokenParser extends AbstractTokenParser
1010
{
1111
public function __construct(
12-
private readonly string $extensionClass,
12+
private string $extensionClass,
1313
) {
1414
}
1515

src/Twig/UnleashTwigExtension.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
final class UnleashTwigExtension extends AbstractExtension
1212
{
1313
public function __construct(
14-
private readonly bool $functionsEnabled,
15-
private readonly bool $filtersEnabled,
16-
private readonly bool $testsEnabled,
17-
private readonly bool $tagsEnabled,
14+
private bool $functionsEnabled,
15+
private bool $filtersEnabled,
16+
private bool $testsEnabled,
17+
private bool $tagsEnabled,
1818
) {
1919
}
2020

src/Twig/UnleashTwigRuntime.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Unleash\Client\DTO\Variant;
88
use Unleash\Client\Unleash;
99

10-
final readonly class UnleashTwigRuntime implements RuntimeExtensionInterface
10+
final class UnleashTwigRuntime implements RuntimeExtensionInterface
1111
{
1212
public function __construct(
1313
private Unleash $unleash,

src/Unleash/UnleashDecorator.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
use Unleash\Client\Unleash;
1515
use Unleash\Client\Variant\VariantHandler;
1616

17-
final readonly class UnleashDecorator implements Unleash
17+
final class UnleashDecorator implements Unleash
1818
{
19+
/**
20+
* @readonly
21+
*/
1922
private Unleash $proxy;
2023

2124
/**

0 commit comments

Comments
 (0)