diff --git a/src/Symfony/Bundle/SecurityBundle/CacheWarmer/ExpressionCacheWarmer.php b/src/Symfony/Bundle/SecurityBundle/CacheWarmer/ExpressionCacheWarmer.php index 5b146871cbe07..748d0b28eb959 100644 --- a/src/Symfony/Bundle/SecurityBundle/CacheWarmer/ExpressionCacheWarmer.php +++ b/src/Symfony/Bundle/SecurityBundle/CacheWarmer/ExpressionCacheWarmer.php @@ -20,16 +20,13 @@ */ class ExpressionCacheWarmer implements CacheWarmerInterface { - private iterable $expressions; - private ExpressionLanguage $expressionLanguage; - /** * @param iterable $expressions */ - public function __construct(iterable $expressions, ExpressionLanguage $expressionLanguage) - { - $this->expressions = $expressions; - $this->expressionLanguage = $expressionLanguage; + public function __construct( + private iterable $expressions, + private ExpressionLanguage $expressionLanguage, + ) { } public function isOptional(): bool diff --git a/src/Symfony/Bundle/SecurityBundle/Command/DebugFirewallCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/DebugFirewallCommand.php index ffc3035a53eb5..63d468b199332 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/DebugFirewallCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/DebugFirewallCommand.php @@ -32,22 +32,16 @@ #[AsCommand(name: 'debug:firewall', description: 'Display information about your security firewall(s)')] final class DebugFirewallCommand extends Command { - private array $firewallNames; - private ContainerInterface $contexts; - private ContainerInterface $eventDispatchers; - private array $authenticators; - /** * @param string[] $firewallNames * @param AuthenticatorInterface[][] $authenticators */ - public function __construct(array $firewallNames, ContainerInterface $contexts, ContainerInterface $eventDispatchers, array $authenticators) - { - $this->firewallNames = $firewallNames; - $this->contexts = $contexts; - $this->eventDispatchers = $eventDispatchers; - $this->authenticators = $authenticators; - + public function __construct( + private array $firewallNames, + private ContainerInterface $contexts, + private ContainerInterface $eventDispatchers, + private array $authenticators + ) { parent::__construct(); } diff --git a/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php b/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php index 2c0562e4066a3..3812f36586e5b 100644 --- a/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php +++ b/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php @@ -36,22 +36,16 @@ */ class SecurityDataCollector extends DataCollector implements LateDataCollectorInterface { - private ?TokenStorageInterface $tokenStorage; - private ?RoleHierarchyInterface $roleHierarchy; - private ?LogoutUrlGenerator $logoutUrlGenerator; - private ?AccessDecisionManagerInterface $accessDecisionManager; - private ?FirewallMapInterface $firewallMap; - private ?TraceableFirewallListener $firewall; private bool $hasVarDumper; - public function __construct(?TokenStorageInterface $tokenStorage = null, ?RoleHierarchyInterface $roleHierarchy = null, ?LogoutUrlGenerator $logoutUrlGenerator = null, ?AccessDecisionManagerInterface $accessDecisionManager = null, ?FirewallMapInterface $firewallMap = null, ?TraceableFirewallListener $firewall = null) - { - $this->tokenStorage = $tokenStorage; - $this->roleHierarchy = $roleHierarchy; - $this->logoutUrlGenerator = $logoutUrlGenerator; - $this->accessDecisionManager = $accessDecisionManager; - $this->firewallMap = $firewallMap; - $this->firewall = $firewall; + public function __construct( + private ?TokenStorageInterface $tokenStorage = null, + private ?RoleHierarchyInterface $roleHierarchy = null, + private ?LogoutUrlGenerator $logoutUrlGenerator = null, + private ?AccessDecisionManagerInterface $accessDecisionManager = null, + private ?FirewallMapInterface $firewallMap = null, + private ?TraceableFirewallListener $firewall = null, + ) { $this->hasVarDumper = class_exists(ClassStub::class); } diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php index bfd96d7ca089d..43667c5e7bc9d 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php @@ -36,16 +36,13 @@ class MainConfiguration implements ConfigurationInterface /** @internal */ public const STRATEGY_PRIORITY = 'priority'; - private array $factories; - private array $userProviderFactories; - /** * @param array $factories */ - public function __construct(array $factories, array $userProviderFactories) - { - $this->factories = $factories; - $this->userProviderFactories = $userProviderFactories; + public function __construct( + private array $factories, + private array $userProviderFactories + ) { } /** diff --git a/src/Symfony/Bundle/SecurityBundle/EventListener/FirewallListener.php b/src/Symfony/Bundle/SecurityBundle/EventListener/FirewallListener.php index 4c63ec18d120d..d2bcb648b27cf 100644 --- a/src/Symfony/Bundle/SecurityBundle/EventListener/FirewallListener.php +++ b/src/Symfony/Bundle/SecurityBundle/EventListener/FirewallListener.php @@ -25,14 +25,11 @@ */ class FirewallListener extends Firewall { - private FirewallMapInterface $map; - private LogoutUrlGenerator $logoutUrlGenerator; - - public function __construct(FirewallMapInterface $map, EventDispatcherInterface $dispatcher, LogoutUrlGenerator $logoutUrlGenerator) - { - $this->map = $map; - $this->logoutUrlGenerator = $logoutUrlGenerator; - + public function __construct( + private FirewallMapInterface $map, + EventDispatcherInterface $dispatcher, + private LogoutUrlGenerator $logoutUrlGenerator + ) { parent::__construct($map, $dispatcher); } diff --git a/src/Symfony/Bundle/SecurityBundle/EventListener/VoteListener.php b/src/Symfony/Bundle/SecurityBundle/EventListener/VoteListener.php index 34ca91c3a7735..54eac4384542a 100644 --- a/src/Symfony/Bundle/SecurityBundle/EventListener/VoteListener.php +++ b/src/Symfony/Bundle/SecurityBundle/EventListener/VoteListener.php @@ -24,11 +24,9 @@ */ class VoteListener implements EventSubscriberInterface { - private TraceableAccessDecisionManager $traceableAccessDecisionManager; - - public function __construct(TraceableAccessDecisionManager $traceableAccessDecisionManager) - { - $this->traceableAccessDecisionManager = $traceableAccessDecisionManager; + public function __construct( + private TraceableAccessDecisionManager $traceableAccessDecisionManager, + ) { } public function onVoterVote(VoteEvent $event): void diff --git a/src/Symfony/Bundle/SecurityBundle/RememberMe/DecoratedRememberMeHandler.php b/src/Symfony/Bundle/SecurityBundle/RememberMe/DecoratedRememberMeHandler.php index ed6d0ed20d5be..dd6072452a205 100644 --- a/src/Symfony/Bundle/SecurityBundle/RememberMe/DecoratedRememberMeHandler.php +++ b/src/Symfony/Bundle/SecurityBundle/RememberMe/DecoratedRememberMeHandler.php @@ -24,11 +24,9 @@ */ final class DecoratedRememberMeHandler implements RememberMeHandlerInterface { - private RememberMeHandlerInterface $handler; - - public function __construct(RememberMeHandlerInterface $handler) - { - $this->handler = $handler; + public function __construct( + private RememberMeHandlerInterface $handler, + ) { } public function createRememberMeCookie(UserInterface $user): void diff --git a/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php b/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php index c100d3531b2c2..63648bd67510e 100644 --- a/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php +++ b/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php @@ -22,20 +22,15 @@ */ class FirewallContext { - private iterable $listeners; - private ?ExceptionListener $exceptionListener; - private ?LogoutListener $logoutListener; - private ?FirewallConfig $config; - /** * @param iterable $listeners */ - public function __construct(iterable $listeners, ?ExceptionListener $exceptionListener = null, ?LogoutListener $logoutListener = null, ?FirewallConfig $config = null) - { - $this->listeners = $listeners; - $this->exceptionListener = $exceptionListener; - $this->logoutListener = $logoutListener; - $this->config = $config; + public function __construct( + private iterable $listeners, + private ?ExceptionListener $exceptionListener = null, + private ?LogoutListener $logoutListener = null, + private ?FirewallConfig $config = null, + ) { } public function getConfig(): ?FirewallConfig diff --git a/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php b/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php index fbb44caeded62..f02b4c2d45106 100644 --- a/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php +++ b/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php @@ -24,13 +24,10 @@ */ class FirewallMap implements FirewallMapInterface { - private ContainerInterface $container; - private iterable $map; - - public function __construct(ContainerInterface $container, iterable $map) - { - $this->container = $container; - $this->map = $map; + public function __construct( + private ContainerInterface $container, + private iterable $map, + ) { } public function getListeners(Request $request): array diff --git a/src/Symfony/Bundle/SecurityBundle/Security/LazyFirewallContext.php b/src/Symfony/Bundle/SecurityBundle/Security/LazyFirewallContext.php index 500b29b1d40ef..6835762315415 100644 --- a/src/Symfony/Bundle/SecurityBundle/Security/LazyFirewallContext.php +++ b/src/Symfony/Bundle/SecurityBundle/Security/LazyFirewallContext.php @@ -25,13 +25,14 @@ */ class LazyFirewallContext extends FirewallContext { - private TokenStorage $tokenStorage; - - public function __construct(iterable $listeners, ?ExceptionListener $exceptionListener, ?LogoutListener $logoutListener, ?FirewallConfig $config, TokenStorage $tokenStorage) - { + public function __construct( + iterable $listeners, + ?ExceptionListener $exceptionListener, + ?LogoutListener $logoutListener, + ?FirewallConfig $config, + private TokenStorage $tokenStorage, + ) { parent::__construct($listeners, $exceptionListener, $logoutListener, $config); - - $this->tokenStorage = $tokenStorage; } public function getListeners(): iterable diff --git a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php index 69b0b2cecbd83..6d287fb85b779 100644 --- a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php +++ b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php @@ -26,15 +26,15 @@ */ class TemplateCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterface { - private ContainerInterface $container; private Environment $twig; - private iterable $iterator; - public function __construct(ContainerInterface $container, iterable $iterator) - { - // As this cache warmer is optional, dependencies should be lazy-loaded, that's why a container should be injected. - $this->container = $container; - $this->iterator = $iterator; + /** + * As this cache warmer is optional, dependencies should be lazy-loaded, that's why a container should be injected. + */ + public function __construct( + private ContainerInterface $container, + private iterable $iterator + ) { } public function warmUp(string $cacheDir, ?string $buildDir = null): array diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configurator/EnvironmentConfigurator.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configurator/EnvironmentConfigurator.php index 64d76c00303f2..35f7b8909b646 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configurator/EnvironmentConfigurator.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configurator/EnvironmentConfigurator.php @@ -22,21 +22,14 @@ */ class EnvironmentConfigurator { - private string $dateFormat; - private string $intervalFormat; - private ?string $timezone; - private int $decimals; - private string $decimalPoint; - private string $thousandsSeparator; - - public function __construct(string $dateFormat, string $intervalFormat, ?string $timezone, int $decimals, string $decimalPoint, string $thousandsSeparator) - { - $this->dateFormat = $dateFormat; - $this->intervalFormat = $intervalFormat; - $this->timezone = $timezone; - $this->decimals = $decimals; - $this->decimalPoint = $decimalPoint; - $this->thousandsSeparator = $thousandsSeparator; + public function __construct( + private string $dateFormat, + private string $intervalFormat, + private ?string $timezone, + private int $decimals, + private string $decimalPoint, + private string $thousandsSeparator, + ) { } public function configure(Environment $environment): void diff --git a/src/Symfony/Bundle/TwigBundle/TemplateIterator.php b/src/Symfony/Bundle/TwigBundle/TemplateIterator.php index bd42f1ac07e8d..04cb2a5a471b0 100644 --- a/src/Symfony/Bundle/TwigBundle/TemplateIterator.php +++ b/src/Symfony/Bundle/TwigBundle/TemplateIterator.php @@ -25,23 +25,19 @@ */ class TemplateIterator implements \IteratorAggregate { - private KernelInterface $kernel; private \Traversable $templates; - private array $paths; - private ?string $defaultPath; - private array $namePatterns; /** * @param array $paths Additional Twig paths to warm * @param string|null $defaultPath The directory where global templates can be stored * @param string[] $namePatterns Pattern of file names */ - public function __construct(KernelInterface $kernel, array $paths = [], ?string $defaultPath = null, array $namePatterns = []) - { - $this->kernel = $kernel; - $this->paths = $paths; - $this->defaultPath = $defaultPath; - $this->namePatterns = $namePatterns; + public function __construct( + private KernelInterface $kernel, + private array $paths = [], + private ?string $defaultPath = null, + private array $namePatterns = [], + ) { } public function getIterator(): \Traversable diff --git a/src/Symfony/Contracts/Service/ServiceLocatorTrait.php b/src/Symfony/Contracts/Service/ServiceLocatorTrait.php index b62ec3e531c9d..a4f287326de8e 100644 --- a/src/Symfony/Contracts/Service/ServiceLocatorTrait.php +++ b/src/Symfony/Contracts/Service/ServiceLocatorTrait.php @@ -26,16 +26,15 @@ class_exists(NotFoundExceptionInterface::class); */ trait ServiceLocatorTrait { - private array $factories; private array $loading = []; private array $providedTypes; /** * @param array $factories */ - public function __construct(array $factories) - { - $this->factories = $factories; + public function __construct( + private array $factories, + ) { } public function has(string $id): bool