8000 Backport type fixes · symfony/symfony@bf286c2 · GitHub
[go: up one dir, main page]

Skip to content

Commit bf286c2

Browse files
Backport type fixes
1 parent e2185bc commit bf286c2

File tree

123 files changed

+202
-410
lines changed

Some content is hidden

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

123 files changed

+202
-410
lines changed

src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function configureOptions(OptionsResolver $resolver)
5050
*
5151
* @return ORMQueryBuilderLoader
5252
*/
53-
public function getLoader(ObjectManager $manager, $queryBuilder, string $class)
53+
public function getLoader(ObjectManager $manager, object $queryBuilder, string $class)
5454
{
5555
if (!$queryBuilder instanceof QueryBuilder) {
5656
throw new \TypeError(sprintf('Expected an instance of "%s", but got "%s".', QueryBuilder::class, get_debug_type($queryBuilder)));
@@ -76,7 +76,7 @@ public function getBlockPrefix()
7676
* @internal This method is public to be usable as callback. It should not
7777
* be used in user code.
7878
*/
79-
public function getQueryBuilderPartsForCachingHash($queryBuilder): ?array
79+
public function getQueryBuilderPartsForCachingHash(object $queryBuilder): ?array
8080
{
8181
if (!$queryBuilder instanceof QueryBuilder) {
8282
throw new \TypeError(sprintf('Expected an instance of "%s", but got "%s".', QueryBuilder::class, get_debug_type($queryBuilder)));

src/Symfony/Bridge/Twig/Node/DumpNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class DumpNode extends Node
2121
{
2222
private $varPrefix;
2323

24-
public function __construct($varPrefix, ?Node $values, int $lineno, string $tag = null)
24+
public function __construct(string $varPrefix, ?Node $values, int $lineno, string $tag = null)
2525
{
2626
$nodes = [];
2727
if (null !== $values) {

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

Lines 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/Console/Application.php

Lines 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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ abstract protected function describeContainerTags(ContainerBuilder $builder, arr
113113
*
114114
* @param Definition|Alias|object $service
115115
*/
116-
abstract protected function describeContainerService($service, array $options = [], ContainerBuilder $builder = null);
116+
abstract protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null);
117117

118118
/**
119119
* Describes container services.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio
6767
$this->writeData($data, $options);
6868
}
6969

70-
protected function describeContainerService($service, array $options = [], ContainerBuilder $builder = null)
70+
protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null)
7171
{
7272
if (!isset($options['id'])) {
7373
throw new \InvalidArgumentException('An "id" option must be provided.');

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio
8888
}
8989
}
9090

91-
protected function describeContainerService($service, array $options = [], ContainerBuilder $builder = null)
91+
protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null)
9292
{
9393
if (!isset($options['id'])) {
9494
throw new \InvalidArgumentException('An "id" option must be provided.');

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio
141141
}
142142
}
143143

144-
protected function describeContainerService($service, array $options = [], ContainerBuilder $builder = null)
144+
protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null)
145145
{
146146
if (!isset($options['id'])) {
147147
throw new \InvalidArgumentException('An "id" option must be provided.');

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio
5353
$this->writeDocument($this->getContainerTagsDocument($builder, isset($options['show_hidden']) && $options['show_hidden']));
5454
}
5555

56-
protected function describeContainerService($service, array $options = [], ContainerBuilder $builder = null)
56+
protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null)
5757
{
5858
if (!isset($options['id'])) {
5959
throw new \InvalidArgumentException('An "id" option must be provided.');
@@ -255,7 +255,7 @@ private function getContainerTagsDocument(ContainerBuilder $builder, bool $showH
255255
return $dom;
256256
}
257257

258-
private function getContainerServiceDocument($service, string $id, ContainerBuilder $builder = null, bool $showArguments = false): \DOMDocument
258+
private function getContainerServiceDocument(object $service, string $id, ContainerBuilder $builder = null, bool $showArguments = false): \DOMDocument
259259
{
260260
$dom = new \DOMDocument('1.0', 'UTF-8');
261261

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ protected function isCsrfTokenValid(string $id, ?string $token): bool
396396
*
397397
* @param object|Envelope $message The message or the message pre-wrapped in an envelope
398398
*/
399-
protected function dispatchMessage($message, array $stamps = []): Envelope
399+
protected function dispatchMessage(object $message, array $stamps = []): Envelope
400400
{
401401
if (!$this->container->has('messenger.default_bus')) {
402402
$message = class_exists(Envelope::class) ? 'You need to define the "messenger.default_bus" configuration option.' : 'Try running "composer require symfony/messenger".';

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ControllerResolver extends ContainerControllerResolver
2424
/**
2525
* {@inheritdoc}
2626
*/
27-
protected function instantiateController($class): object
27+
protected function instantiateController(string $class): object
2828
{
2929
$controller = parent::instantiateController($class);
3030

src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php

Lines 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

Lines 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 object $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/Test/BrowserKitAssertionsTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public static function assertRequestAttributeValueSame(string $name, string $exp
112112
self::assertThat(self::getRequest(), new ResponseConstraint\RequestAttributeValueSame($name, $expectedValue), $message);
113113
}
114114

115-
public static function assertRouteSame($expectedRoute, array $parameters = [], string $message = ''): void
115+
public static function assertRouteSame(string $expectedRoute, array $parameters = [], string $message = ''): void
116116
{
117117
$constraint = new ResponseConstraint\RequestAttributeValueSame('_route', $expectedRoute);
118118
$constraints = [];

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/JsonLoginFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected function getListenerId()
7575
/**
7676
* {@inheritdoc}
7777
*/
78-
protected function isRememberMeAware($config)
78+
protected function isRememberMeAware(array $config)
7979
{
8080
return false;
8181
}

src/Symfony/Bundle/SecurityBundle/Security/FirewallConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class FirewallConfig
2929
private $listeners;
3030
private $switchUser;
3131

32-
public function __construct(string $name, string $userChecker, string $requestMatcher = null, bool $securityEnabled = true, bool $stateless = false, string $provider = null, string $context = null, string $entryPoint = null, string $accessDeniedHandler = null, string $accessDeniedUrl = null, array $listeners = [], $switchUser = null)
32+
public function __construct(string $name, string $userChecker, string $requestMatcher = null, bool $securityEnabled = true, bool $stateless = false, string $provider = null, string $context = null, string $entryPoint = null, string $accessDeniedHandler = null, string $accessDeniedUrl = null, array $listeners = [], array $switchUser = null)
3333
{
3434
$this->name = $name;
3535
$this->userChecker = $userChecker;

src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ private function hasHashOrNonce(array $directives): bool
235235
return false;
236236
}
237237

238-
private function getDirectiveFallback(array $directiveSet, $type)
238+
private function getDirectiveFallback(array $directiveSet, string $type)
239239
{
240240
if (\in_array($type, ['script-src-elem', 'style-src-elem'], true) || !isset($directiveSet['default-src'])) {
241241
// Let the browser fallback on it's own

src/Symfony/Component/BrowserKit/Tests/TestClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ public function setNextResponse(Response $response)
2424
$this->nextResponse = $response;
2525
}
2626

27-
public function setNextScript($script)
27+
public function setNextScript(string $script)
2828
{
2929
$this->nextScript = $script;
3030
}
3131

32-
protected function doRequest($request): Response
32+
protected function doRequest(object $request): Response
3333
{
3434
if (null === $this->nextResponse) {
3535
return new Response();
@@ -41,7 +41,7 @@ protected function doRequest($request): Response
4141
return $response;
4242
}
4343

44-
protected function getScript($request)
44+
protected function getScript(object $request)
4545
{
4646
$r = new \ReflectionClass(Response::class);
4747
$path = $r->getFileName();

src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ public function setNextResponse(Response $response)
4747
$this->nextResponse = $response;
4848
}
4949

50-
public function setNextScript($script)
50+
public function setNextScript(string $script)
5151
{
5252
$this->nextScript = $script;
5353
}
5454

55-
protected function doRequest($request): Response
55+
protected function doRequest(object $request): Response
5656
{
5757
if (null === $this->nextResponse) {
5858
return parent::doRequest($request);
@@ -64,7 +64,7 @@ protected function doRequest($request): Response
6464
return $response;
6565
}
6666

67-
protected function getScript($request)
67+
protected function getScript(object $request)
6868
{
6969
$r = new \ReflectionClass(Response::class);
7070
$path = $r->getFileName();

src/Symfony/Component/Config/Definition/ArrayNode.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
3232
protected $removeExtraKeys = true;
3333
protected $normalizeKeys = true;
3434

35-
public function setNormalizeKeys($normalizeKeys)
35+
public function setNormalizeKeys(bool $normalizeKeys)
3636
{
37-
$this->normalizeKeys = (bool) $normalizeKeys;
37+
$this->normalizeKeys = $normalizeKeys;
3838
}
3939

4040
/**

src/Symfony/Component/Config/Definition/BaseNode.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ public function addEquivalentValue($originalValue, $equivalentValue)
187187

188188
/**
189189
* Set this node as required.
190-
*
191-
* @param bool $boolean Required node
192190
*/
193191
public function setRequired(bool $boolean)
194192
{

src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ public function end()
105105
/**
106106
* Creates the node.
107107
*
108-
* @param bool $forceRootNode Whether to force this node as the root node
109-
*
110108
* @return NodeInterface
111109
*/
112110
public function getNode(bool $forceRootNode = false)

src/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class InvalidConfigurationException extends Exception
2222
private $path;
2323
private $containsHints = false;
2424

25-
public function setPath($path)
25+
public function setPath(string $path)
2626
{
2727
$this->path = $path;
2828
}

src/Symfony/Component/Config/ResourceCheckerConfigCache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ private function safelyUnserialize(string $file)
181181
/**
182182
* @internal
183183
*/
184-
public static function handleUnserializeCallback($class)
184+
public static function handleUnserializeCallback(string $class)
185185
{
186186
trigger_error('Class not found: '.$class);
187187
}

src/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ protected function getPrototypeNodeWithDefaultChildren()
264264
*
265265
* @dataProvider getDataForKeyRemovedLeftValueOnly
266266
*/
267-
public function testMappedAttributeKeyIsRemovedLeftValueOnly($value, $children, array $expected)
267+
public function testMappedAttributeKeyIsRemovedLeftValueOnly($value, array $children, array $expected)
268268
{
269269
$node = new PrototypedArrayNode('root');
270270
$node->setKeyAttribute('id', true);

src/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php

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

1717
class NodeBuilder extends BaseNodeBuilder
1818
{
19-
public function barNode($name): NodeDefinition
19+
public function barNode(?string $name): NodeDefinition
2020
{
2121
return $this->node($name, 'bar');
2222
}

src/Symfony/Component/Config/Tests/Resource/ResourceStub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __toString(): string
2727
return 'stub';
2828
}
2929

30-
public function isFresh($timestamp): bool
30+
public function isFresh(int $timestamp): bool
3131
{
3232
return $this->fresh;
3333
}

src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function getDataForConvertDomToArray(): array
150150
/**
151151
* @dataProvider getDataForPhpize
152152
*/
153-
public function testPhpize($expected, $value)
153+
public function testPhpize($expected, string $value)
154154
{
155155
$this->assertSame($expected, XmlUtils::phpize($value));
156156
}

src/Symfony/Component/Console/Command/Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ public function getNativeDefinition()
376376
* Adds an argument.
377377
*
378378
* @param int|null $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL
379-
* @param mixed $default The default value (for InputArgument::OPTIONAL mode only)
379+
* @param mixed $default The default value (for InputArgument::OPTIONAL mode only)
380380
*
381381
* @throws InvalidArgumentException When argument mode is not valid
382382
*

src/Symfony/Component/Console/Descriptor/Descriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ abstract class Descriptor implements DescriptorInterface
3434
/**
3535
* {@inheritdoc}
3636
*/
37-
public function describe(OutputInterface $output, $object, array $options = [])
37+
public function describe(OutputInterface $output, object $object, array $options = [])
3838
{
3939
$this->output = $output;
4040

src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class MarkdownDescriptor extends Descriptor
3131
/**
3232
* {@inheritdoc}
3333
*/
34-
public function describe(OutputInterface $output, $object, array $options = [])
34+
public function describe(OutputInterface $output, object $object, array $options = [])
3535
{
3636
$decorated = $output->isDecorated();
3737
$output->setDecorated(false);

src/Symfony/Component/Console/Input/InputOption.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ class InputOption
4848
private $description;
4949

5050
/**
51-
* @param string $name The option name
52-
* @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
53-
* @param int|null $mode The option mode: One of the VALUE_* constants
54-
* @param string $description A description text
55-
* @param mixed $default The default value (must be null for self::VALUE_NONE)
51+
* @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
52+
* @param int|null $mode The option mode: One of the VALUE_* constants
53+
* @param mixed $default The default value (must be null for self::VALUE_NONE)
5654
*
5755
* @throws InvalidArgumentException If option mode is invalid or incompatible
5856
*/

src/Symfony/Component/Console/Output/ConsoleSectionOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function addContent(string $input)
9292
/**
9393
* {@inheritdoc}
9494
*/
95-
protected function doWrite($message, $newline)
95+
protected function doWrite(string $message, bool $newline)
9696
{
9797
if (!$this->isDecorated()) {
9898
parent::doWrite($message, $newline);

src/Symfony/Component/Console/Output/TrimmedBufferOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function fetch()
5454
/**
5555
* {@inheritdoc}
5656
*/
57-
protected function doWrite($message, $newline)
57+
protected function doWrite(string $message, bool $newline)
5858
{
5959
$this->buffer .= $message;
6060

0 commit comments

Comments
 (0)
0