Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dd44cab

Browse filesBrowse files
minor #41907 [FrameworkBundle] add union types (nicolas-grekas)
This PR was merged into the 6.0 branch. Discussion ---------- [FrameworkBundle] add union types | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Part of #41424 | License | MIT | Doc PR | - Commits ------- e85e459 [FrameworkBundle] add union types
2 parents bf5dc51 + e85e459 commit dd44cab
Copy full SHA for dd44cab

18 files changed

+28
-47
lines changed

‎src/Symfony/Bundle/FrameworkBundle/CacheWarmer/CachePoolClearerCacheWarmer.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/CacheWarmer/CachePoolClearerCacheWarmer.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(Psr6CacheClearer $poolClearer, array $pools = [])
3939
*
4040
* @return string[]
4141
*/
42-
public function warmUp($cacheDirectory): array
42+
public function warmUp(string $cacheDirectory): array
4343
{
4444
foreach ($this->pools as $pool) {
4545
if ($this->poolClearer->hasPool($pool)) {

‎src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
120120
return 0;
121121
}
122122

123-
private function searchForEvent(EventDispatcherInterface $dispatcher, $needle): array
123+
private function searchForEvent(EventDispatcherInterface $dispatcher, string $needle): array
124124
{
125125
$output = [];
126126
$lcNeedle = strtolower($needle);

‎src/Symfony/Bundle/FrameworkBundle/Console/Application.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Console/Application.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
109109
/**
110110
* {@inheritdoc}
111111
*/
112-
public function find($name)
112+
public function find(string $name)
113113
{
114114
$this->registerCommands();
115115

@@ -119,7 +119,7 @@ public function find($name)
119119
/**
120120
* {@inheritdoc}
121121
*/
122-
public function get($name)
122+
public function get(string $name)
123123
{
124124
$this->registerCommands();
125125

@@ -135,7 +135,7 @@ public function get($name)
135135
/**
136136
* {@inheritdoc}
137137
*/
138-
public function all($namespace = null)
138+
public function all(string $namespace = null)
139139
{
140140
$this->registerCommands();
141141

‎src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
+3-13Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ abstract protected function describeContainerDefinition(Definition $definition,
129129

130130
abstract protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null);
131131

132-
abstract protected function describeContainerParameter($parameter, array $options = []);
132+
abstract protected function describeContainerParameter(mixed $parameter, array $options = []);
133133

134134
abstract protected function describeContainerEnvVars(array $envs, array $options = []);
135135

@@ -141,19 +141,9 @@ abstract protected function describeContainerEnvVars(array $envs, array $options
141141
*/
142142
abstract protected function describeEventDispatcherListeners(EventDispatcherInterface $eventDispatcher, array $options = []);
143143

144-
/**
145-
* Describes a callable.
146-
*
147-
* @param mixed $callable
148-
*/
149-
abstract protected function describeCallable($callable, array $options = []);
144+
abstract protected function describeCallable(mixed $callable, array $options = []);
150145

151-
/**
152-
* Formats a value as string.
153-
*
154-
* @param mixed $value
155-
*/
156-
protected function formatValue($value): string
146+
protected function formatValue(mixed $value): string
157147
{
158148
if (\is_object($value)) {
159149
return sprintf('object(%s)', \get_class($value));

‎src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected function describeEventDispatcherListeners(EventDispatcherInterface $ev
139139
$this->writeData($this->getEventDispatcherListenersData($eventDispatcher, $options), $options);
140140
}
141141

142-
protected function describeCallable($callable, array $options = [])
142+
protected function describeCallable(mixed $callable, array $options = [])
143143
{
144144
$this->writeData($this->getCallableData($callable), $options);
145145
}

‎src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ protected function redirectToRoute(string $route, array $parameters = [], int $s
168168
/**
169169
* Returns a JsonResponse that uses the serializer component if enabled, or json_encode.
170170
*/
171-
protected function json($data, int $status = 200, array $headers = [], array $context = []): JsonResponse
171+
protected function json(mixed $data, int $status = 200, array $headers = [], array $context = []): JsonResponse
172172
{
173173
if ($this->container->has('serializer')) {
174174
$json = $this->container->get('serializer')->serialize($data, 'json', array_merge([

‎src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,10 @@ class ControllerResolver extends ContainerControllerResolver
2424
/**
2525
* {@inheritdoc}
2626
*/
27-
protected function instantiateController($class): object
27+
protected function instantiateController(string $class): object
2828
{
29-
return $this->configureController(parent::instantiateController($class), $class);
30-
}
29+
$controller = parent::instantiateController($class);
3130

32-
private function configureController($controller, string $class): object
33-
{
3431
if ($controller instanceof ContainerAwareInterface) {
3532
$controller->setContainer($this->container);
3633
}

‎src/Symfony/Bundle/FrameworkBundle/DataCollector/RouterDataCollector.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DataCollector/RouterDataCollector.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@
1616
use Symfony\Component\HttpKernel\DataCollector\RouterDataCollector as BaseRouterDataCollector;
1717

1818
/**
19-
* RouterDataCollector.
20-
*
2119
* @author Fabien Potencier <fabien@symfony.com>
2220
*
2321
* @final
2422
*/
2523
class RouterDataCollector extends BaseRouterDataCollector
2624
{
27-
public function guessRoute(Request $request, $controller)
25+
public function guessRoute(Request $request, mixed $controller)
2826
{
2927
if (\is_array($controller)) {
3028
$controller = $controller[0];

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddDebugLogProcessorPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddDebugLogProcessorPass.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function process(ContainerBuilder $container)
3434
$definition->addMethodCall('pushProcessor', [new Reference('debug.log_processor')]);
3535
}
3636

37-
public static function configureLogger($logger)
37+
public static function configureLogger(mixed $logger)
3838
{
3939
if (\is_object($logger) && method_exists($logger, 'removeDebugLogger') && \in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
4040
$logger->removeDebugLogger();

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ private function addAnnotationsSection(ArrayNodeDefinition $rootNode, callable $
960960
;
961961
}
962962

963-
private function addSerializerSection(ArrayNodeDefinition $rootNode, callable $enableIfStandalone, $willBeAvailable)
963+
private function addSerializerSection(ArrayNodeDefinition $rootNode, callable $enableIfStandalone, callable $willBeAvailable)
964964
{
965965
$rootNode
966966
->children()

‎src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ class HttpCache extends BaseHttpCache
3535
private $options;
3636

3737
/**
38-
* @param string|StoreInterface $cache The cache directory (default used if null) or the storage instance
38+
* @param $cache The cache directory (default used if null) or the storage instance
3939
*/
40-
public function __construct(KernelInterface $kernel, $cache = null, SurrogateInterface $surrogate = null, array $options = null)
40+
public function __construct(KernelInterface $kernel, string|StoreInterface $cache = null, SurrogateInterface $surrogate = null, array $options = null)
4141
{
4242
$this->kernel = $kernel;
4343
$this->surrogate = $surrogate;

‎src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function enableReboot()
112112
/**
113113
* @param UserInterface $user
114114
*/
115-
public function loginUser($user, string $firewallContext = 'main'): self
115+
public function loginUser(object $user, string $firewallContext = 'main'): self
116116
{
117117
if (!interface_exists(UserInterface::class)) {
118118
throw new \LogicException(sprintf('"%s" requires symfony/security-core to be installed.', __METHOD__));

‎src/Symfony/Bundle/FrameworkBundle/Routing/AnnotatedRouteControllerLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Routing/AnnotatedRouteControllerLoader.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ class AnnotatedRouteControllerLoader extends AnnotationClassLoader
2424
{
2525
/**
2626
* Configures the _controller default parameter of a given Route instance.
27-
*
28-
* @param mixed $annot The annotation class instance
2927
*/
30-
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot)
28+
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot)
3129
{
3230
if ('__invoke' === $method->getName()) {
3331
$route->setDefault('_controller', $class->getName());

‎src/Symfony/Bundle/FrameworkBundle/Routing/Router.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Routing/Router.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberI
4040
/**
4141
* @param mixed $resource The main resource to load
4242
*/
43-
public function __construct(ContainerInterface $container, $resource, array $options = [], RequestContext $context = null, ContainerInterface $parameters = null, LoggerInterface $logger = null, string $defaultLocale = null)
43+
public function __construct(ContainerInterface $container, mixed $resource, array $options = [], RequestContext $context = null, ContainerInterface $parameters = null, LoggerInterface $logger = null, string $defaultLocale = null)
4444
{
4545
$this->container = $container;
4646
$this->resource = $resource;
@@ -154,7 +154,7 @@ private function resolveParameters(RouteCollection $collection)
154154
* @throws ParameterNotFoundException When a placeholder does not exist as a container parameter
155155
* @throws RuntimeException When a container value is not a string or a numeric value
156156
*/
157-
private function resolve($value)
157+
private function resolve(mixed $value)
158158
{
159159
if (\is_array($value)) {
160160
foreach ($value as $key => $val) {

‎src/Symfony/Bundle/FrameworkBundle/Secrets/SodiumVault.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Secrets/SodiumVault.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ class SodiumVault extends AbstractVault implements EnvVarLoaderInterface
2929
private $secretsDir;
3030

3131
/**
32-
* @param string|\Stringable|null $decryptionKey A string or a stringable object that defines the private key to use to decrypt the vault
33-
* or null to store generated keys in the provided $secretsDir
32+
* @param $decryptionKey A string or a stringable object that defines the private key to use to decrypt the vault
33+
* or null to store generated keys in the provided $secretsDir
3434
*/
35-
public function __construct(string $secretsDir, $decryptionKey = null)
35+
public function __construct(string $secretsDir, string|\Stringable $decryptionKey = null)
3636
{
3737
if (null !== $decryptionKey && !\is_string($decryptionKey) && !$decryptionKey instanceof \Stringable) {
3838
throw new \TypeError(sprintf('Decryption key should be a string or an object that implements the __toString() method, "%s" given.', get_debug_type($decryptionKey)));

‎src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public static function assertRequestAttributeValueSame(string $name, string $exp
117117
self::assertThat(self::getRequest(), new ResponseConstraint\RequestAttributeValueSame($name, $expectedValue), $message);
118118
}
119119

120-
public static function assertRouteSame($expectedRoute, array $parameters = [], string $message = ''): void
120+
public static function assertRouteSame(string $expectedRoute, array $parameters = [], string $message = ''): void
121121
{
122122
$constraint = new ResponseConstraint\RequestAttributeValueSame('_route', $expectedRoute);
123123
$constraints = [];

‎src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ public function hasParameter(string $name): bool
8282
/**
8383
* {@inheritdoc}
8484
*/
85-
public function setParameter(string $name, $value)
85+
public function setParameter(string $name, mixed $value)
8686
{
8787
$this->getPublicContainer()->setParameter($name, $value);
8888
}
8989

9090
/**
9191
* {@inheritdoc}
9292
*/
93-
public function set(string $id, $service)
93+
public function set(string $id, mixed $service)
9494
{
9595
$this->getPublicContainer()->set($id, $service);
9696
}

‎src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
use Symfony\Component\Translation\Translator as BaseTranslator;
2121

2222
/**
23-
* Translator.
24-
*
2523
* @author Fabien Potencier <fabien@symfony.com>
2624
*/
2725
class Translator extends BaseTranslator implements WarmableInterface
@@ -119,7 +117,7 @@ public function warmUp(string $cacheDir)
119117
return [];
120118
}
121119

122-
public function addResource(string $format, $resource, string $locale, string $domain = null)
120+
public function addResource(string $format, mixed $resource, string $locale, string $domain = null)
123121
{
124122
if ($this->resourceFiles) {
125123
$this->addResourceFiles();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.